• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

保持NSTimer活在iOS 7的背景

用户头像
it1352
帮助1

问题说明

我创建了在后台运行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应用程序中每n分钟更新一次背景位置?

这种方法在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.

提前感谢。

正确答案

#1

,存在用于周期性数据提取的新模式。将 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
系列文章
更多 icon
同类精品
更多 icon
继续加载