views:

239

answers:

2

I have the following delegate method of NSURLConnection

- (void)connectionDidFinishLoading:(NSURLConnection *)connection

{

    NSLog(@"DONE, Receive bytes: %d", [webData length]);

NSString *theXML = [[NSString alloc]initWithBytes:[webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
//NSLog(theXML);
[theXML release];

if(xmlParser)
{
 [xmlParser release];  
}
else 
{
 xmlParser = [[NSXMLParser alloc]initWithData:webData];
 [xmlParser setDelegate:self];
 [xmlParser setShouldResolveExternalEntities:YES];
 [xmlParser parse];
 [connection release];
 [webData release];
 NSLog(@"\n\n\n\n");
 NSLog(httpResult);
}

I want to return httpResult - how do i do this? I have the above method in a class. I create an instance of this class in another controller class which calls a function to create an http request. This function then in turn calls this delegate method. How do i return httpResult to the controller class?

I have figured it out - thanks guys

+3  A: 

Give that class either a delegate or a didFinish-type callback and set that to tell your controller when it's done.

Chuck
can u provide me a specific code of example of how to do this
zPesk
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/
Peter Hosey
A: 

Or you could use a notification.

how would i do this could u please provide me a code example????
zPesk