I would like to ask you about NSURLConnection in objective-c for iPhone.

I have one app that needs to connect to one webservice to receive data (about YouTube videos), Then I have all the things that I need to connect (Similar to Hello_Soap sample code in the web).

But now, my problem is that I create a class (inherits from NSObject) named Connection and I have implemented the methods: didReceiveResponse, didReceiveData, didFailWithError and connectionDidFinishLoading. Also the method:

-(void)Connect:(NSString *) soapMessage{     NSLog(soapMessage);      NSURL *url = [NSURL URLWithString:@"http://....."];     NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];     NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];       [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];     [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];     [theRequest setHTTPMethod:@"POST"];     [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];      NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];      if( theConnection )     {         webData = [[NSMutableData data] retain];     }     else     {         NSLog(@"theConnection is NULL");     } } 

But when from my AppDelegate I create one Connection object:

Connection * connect = [[Connection alloc] Init:num]; //It's only one param to test. [connect Connect:method.soapMessage]; 

And I call this method, when this finishes, it doesn't continue calling didReceiveResponse, didReceiveData, didFailWithError or connectionDidFinishLoading. I'm trying to do this but I can't for the moment.

The thing I would like to do is to be able to call this class "Connection" each time that I want to receive data (after that to be parsed and displayed in UITableViews).

Thank you.

Manage user's session on a web server for an iPhone app user [closed]


UIProgressBar loading NSMutableDictionary
A starting point I would explore is to not name your class "Connect". Prompting and Delegate question There are no name spaces in Objective-C, and with a name as generic as "Connect" it's possible another classes of the same name are causing you issues.. Results for performSelector: differ from standard dot notation call? The convention is to prepend a few characters related to the project or your company, so for instance if your project is named Amazing Thing you might name the class "ATConnector" instead. How to add a breakpoint to objc_exception_throw? You must highlight the class name in the .h file and use the "Refactor" menu command to change it easily while fixing another references too.. How to specify an beginTime for an animation by using CFTimeInterval? Also if you were releasing either the Connect class or the NSURLconnection after calling, this would have the effect you are seeing of no delegate methods receive ting called - although that's hard to determine from the code present.. iPhone web application development [closed]
Reload model for UITableViewController before [tableview reloadData]

72 out of 100 based on 67 user ratings 382 reviews