Reputation: 4520
I want to load something (big) asynchronously in a background thread (use with NSOperation).
after many searches I came across two options: The first is use with:
CFRunLoopRun()
which explain wonderful in this link : http://www.russellj.co.uk/blog/2011/07/09/nsurlconnection-in-a-background-thread/
the second is use with:
NSPort* port = [NSPort port];
NSRunLoop* rl = [NSRunLoop currentRunLoop]; // Get the runloop
rl addPort:port forMode:NSDefaultRunLoopMode];
which explain good in this link : http://www.cocoaintheshell.com/2011/04/nsurlconnection-synchronous-asynchronous/
I realy want to use with the first option because is very elegant and readability. but I'm afraid I do not really understand the differences between the two approaches.
Thanks for help.
Upvotes: 1
Views: 1749
Reputation: 2619
I'd recommend the following built-in method if it suits your needs. It's easy to use and is reliable.
Upvotes: 1