应用程序进入applicationDidEnterBackground后,我们应该怎么做才能运行NSoperationqueue?

时间:2014-06-09 05:33:39

标签: ios ios7

即使应用程序在退出主页按钮后进入bacground,我也想下载。但是NSoperationqueue会自动执行吗?   我应该在Plist中设置UI背景模式的值为" Fetch" ?

如果可以在应用程序后台模式下运行NSoperationqueue,UIupdation是否仅在进入前景后才会发生?

Any tutorial or example please ?

1 个答案:

答案 0 :(得分:1)

使用NSURLSession在后​​台下载(仅限iOS7 +)。

教程:here

NSURLSession WWDC 2013视频:here

希望这有帮助。

========== UPDATE ===========

您似乎想要执行后台提取。

NSOperationQueue不会自动完成。您需要在应用目标的功能标签中启用后台提取。

enter image description here

之后在你的plist中指定Required background modes

enter image description here

是否可以在应用后台模式下运行NSoperationqueue?

是的。您可以在AppDelegate的后台获取处理程序中使用NSOperationQueue

-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

PS。关于使用后台提取的好read

相关问题