保持NSTimer活在iOS 7的背景
问题说明
我创建了在后台运行NSTimer的应用程序。我使用位置管理器在后台运行NSTimer,
I have created Application which runs NSTimer in Background. I used the Location manager to run the NSTimer in background,
我在下面使用链接在后台运行NSTimer,
I used below link to run NSTimer in background,
这种方法在iOS 6中可以正常工作, iOS 7.我的应用程序崩溃一段时间后的应用程序在iOS 7的后台。
This approach works fine in iOS 6 but not works on iOS 7. My Application crashes after some time while Application in background on iOS 7.
请让我知道如果任何不同的方法在后台运行NSTimer 。
Please let me know if any different approach to run the NSTimer in background.
提前感谢。
正确答案
,存在用于周期性数据提取的新模式。将 fetch
后台模式添加到您的应用程序,并在您的应用程序委托中传递一个间隔到 - [UIApplication setMinimumBackgroundFetchInterval:
。
In iOS7, there is a new mode for periodic data fetch. Add the fetch
background mode to your app, and in your application delegate, pass an interval to - [UIApplication setMinimumBackgroundFetchInterval:
. Your app's delegate will start receiving calls to application:performFetchWithCompletionHandler:
once the app is in the background.
更多信息,您的应用程序代理将开始接收对应用程序:performFetchWithCompletionHandler:
这里:
https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:performFetchWithCompletionHandler :
More information here: https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/application:performFetchWithCompletionHandler:
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcfiahh
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20