ios - 使用 iOS7 Background Fetch 来 ping 服务器

标签 ios objective-c multitasking

我想使用 iOS7 的后台获取功能以便每天 ping 服务器一次。 我不想提取任何新数据 - 但我只想知道该应用程序仍安装在手机上。

我可以启用后台获取,将最小后台获取间隔设置为 24 小时,并始终将 UIBackgroundFetchResultNoData 返回给 completionHandler

我不需要它每天都在准确的时间。一天一次就足够了。

Apple 会批准我在 App Store 上的应用程序吗? 我可以依靠 iOS 每天至少唤醒我的应用程序一次并执行此操作吗? 我担心如果答案总是 UIBackgroundFetchResultNoData iOS 将停止唤醒我的应用程序。

最佳答案

如果您的应用被用户终止,看起来后台获取和远程通知将不会工作。

根据UIApplicationDelegate Protocol Reference :

However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.

关于ios - 使用 iOS7 Background Fetch 来 ping 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25718323/

相关文章:

ios - CATransform3DRotate 之后的 View 裁剪

ios - performSegueWithIdentifier 和 viewDidLoad

iphone - 获取 NSFileWrapper 的路径

iphone - 应用程序再次激活后如何刷新 UITableView?

iOS7如何以编程方式显示iPhone多任务屏幕黑屏?

ios - 保存在应用程序中拍摄的照片并使用核心数据

ios - 我们可以为一个 View Controller 使用两个不同的 Xib 吗?

IOS 编码正文邮件(为 SES 创建我自己的 mime 邮件)

objective-c - UIDocumentInteractionController 中的 "Expression Result Unused"

ios - 在后台将位置发送到服务器 - ios 7