Re: NSSharingService with Animated GIFs?
Re: NSSharingService with Animated GIFs?
- Subject: Re: NSSharingService with Animated GIFs?
- From: Charles Carver <email@hidden>
- Date: Sat, 17 May 2014 03:16:06 -0400
Ken,
Thanks for the tips! As I’m new to Cocoa, they’re all very helpful.
> You should consider what happens if the server is slow to respond. The above call will block until the image download is complete. Better to use the asynchronous URL loading mechanisms in the frameworks (e.g. NSURLSession).
While working on a similar image download method for a different part of my app, I also encountered the blocking nature of writeToURL. I Googled for a solution (not wanting to refactor my saving with NSURLSession), and found an SO question (http://stackoverflow.com/questions/16283652/understanding-dispatch-async) on dispatch_async.
Per the top answer, I implemented the following...
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
...
});
…to handle the synchronistic nature of my file download/saving.
Is this frowned upon? Would it be more beneficial in the long run to use NSURLSession instead?
Charles Carver
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden