Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

pecorrea

macrumors newbie
Original poster
Dec 19, 2008
2
0
Hi there,

I ask for your help here, i'm having a trouble (maybe it's conceptual too). I'm using some webservices to get data, but first there's a webservice to login, that returns a sessionId when successful. I've been using the code from icodeblog's tutorial about SOAP web services (this one), but my problem is that i need this SOAP login thing to lock the application (like running on the main thread).

I've tried the performSelectorOnMainThread method, but my class doesn't recognize my selector ("[MainData login:]: unrecognized selector sent to instance 0x529f60'"). My code is something like this:

Code:
- (void) init {
 // some code ...
lg = [[LoginWebServiceData alloc] init];
	[self performSelectorOnMainThread:@selector(login:) withObject:nil waitUntilDone:YES];
// After login, we check what's on LoginWebServiceData's sessionId to see if there's a valid response
	sessionId = lg.sessionId;
}

- (void)login {
	[lg loginWithUsernameAndPassword:@"asdf" :@"asdf"];
}

Login is declared on the interface, so i don't know what's wrong ;( I think i can use the Synchronous request, but i think this is a better way to do this. Any ideas? :D
 
Your selector is login: but your method is just login (i.e. takes no arguments). You need to change your selector to match your method.
 
thanks jnic, now almost evrything is right. After testing my method to make synchronous SOAP, it doens't work :( looks like the Connection ([[NSURLConnection alloc] initWithRequest:theRequest delegate:self] ) runs on a different thread and i'll have to use "sendSynchronousRequest:returningResponse:error:", but i don't see a delegate there (the common request asks for a delegate). Does it have the same behavior as the asynchronous request? :eek:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.