18 May 2011, 9:15 PM

We came across the issue of NSURLConnection not being called until the Modal was stopped using [NSApp stop] and this is the way around it. We have to use RunLoop.

- (void) awakeFromNib {

NSURL *url=[[NSURL alloc] initWithString:@"/linkout.php?url=olliekett.com"];

NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];

 

NSURLConnection *c = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self startImmediately:YES];

responseData=[[NSMutableData data] retain];

 

CFRunLoopRun();

}



Then you will need to stop CFRunLoopRun();

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {

NSString *alert = [NSString stringWithFormat:@"Connection failed: %@", [error description]];

NSLog(alert);

 

CFRunLoopStop(CFRunLoopGetCurrent());

}

 

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {

CFRunLoopStop(CFRunLoopGetCurrent()); 

 

NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(responseString);

 

[connection release];

}




We have a large portfolio of work we have completed for clients. Our portfolio always carries our current new iPhone applications. Take a look

Follow us on Twitter, We aim to provide Live Information - @olliekett
 

© OKD Limited 2010 | Contact Us
OKD Limited is a private registered company in England and Wales.
 
Ollie Kett Designs - Tracking System