I have a connection in a thread, so I add it to the run loop to get all data:
[[NSRunLoop currentRunLoop] run];
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
But I can't find any way to stop it
- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
if([NSRunLoop currentRunLoop]){
[[NSRunLoop currentRunLoop] cancelPerformSelectorsWithTarget:self];
}
[connection cancel];
}
How can I stop this loop?
You can stop the runloop by Core Fundation API :
CFRunLoopStop(CFRunLoopGetCurrent());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With