user141302
user141302

Reputation:

What should we do to run NSoperationqueue after app enters applicationDidEnterBackground?

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

Answers (1)

Aditya Sinha
Aditya Sinha

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.

enter image description here

After that specify Required background modes in your plist.

enter image description here

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

Related Questions