Reputation:
I want to download even when app enters in bacground after quiting home button.But Will NSoperationqueue do it automatically ? should I set UI Background Modes in Plist with value "Fetch" ?
If it is possible to run NSoperationqueue in app background mode, Will UIupdation happen only after entering foreground only?
Upvotes: 0
Views: 561
Reputation: 103
Use NSURLSession
to download in background (iOS7+ only).
Tutorial: here
NSURLSession WWDC 2013 Video: here
Hope this helps.
==========UPDATE===========
It seems you want to perform background fetch.
NSOperationQueue won't do it automatically. You'll need to enable background fetch in capabilities tab of your app's target.
After that specify Required background modes
in your plist.
Is it possible to run NSoperationqueue in app background mode ?
Yes it is. You can use NSOperationQueue in background fetch handler of AppDelegate
-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
PS. A good read on using background fetch.
Upvotes: 0