What I am trying to do is getting response for following method
- (void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { }
after calling this
NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[conn scheduleInRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
[conn start];
inside a
dispatch_async();
But the connection
method is not calling. But when I run the NSURLConnection
code outside the dispatch_async
it call the method.
What is the reason for that and how can I correct it?
Is that because delegate
refers to self
and self
refers the the background thread but not the UIViewController
class itself?