> I've been reading (and trying out) a few approaches on HTTP communication 
> using GCD to do a dispatch_sync or dispatch_async to a dispatch queue or 
> using an NSURLRequest.
> 
> Which of these is the preferred method for ingesting strings from HTTP URLs 
> on iOS?  Are there any plusses to one over the other?

FWIW, my view is that it depends on what your requirements are. For a simple 
request, you can go with an [NSString stringWithContentsOfURL] wrapped in a 
call to dispatch_async to avoid blocking the main thread. 

If you require a more sophisticated level of control over the transaction, 
NSURLRequest is obviously a better choice. Personally, I almost always find 
this to be the case, if only because I can cancel a request if necessary.

As for running an NSURLRequest on a thread other than the main thread, I've 
found very little use for it unless you need the download to continue after 
your app has been pushed into the background. Otherwise, it just introduces an 
additional level of complexity that I prefer to avoid if I can :-)


—Mt.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to