I have an app that uses the iPhone's contacts. With iOS 6, the user will be prompted for Contact access on the first try. At this point, the user can hit 'Allow' or 'Don't Allow'. The problem is when the user backgrounds the app, and then navigates to Settings->Privacy->Contacts to toggle the Contact privacy setting for my app. Once it is toggled, I can see on the console that my app:

应用程序:com.myApp’异常退出,信号为9:Killed:9

我在苹果的文档中找不到任何相关信息.有人知道预防这种情况的方法吗?这是设计的吗?或者这是苹果病毒?

推荐答案

操作系统发送了一个不是崩溃的SIGKILL——iOS6中关于隐私的苹果会话说:

  • 如果权限更改,应用程序将退出.
  • 如果已注册,则调用后台任务过期处理程序
  • 然后iOS会终止应用程序.

WWDC 2012 Session Videos: Privacy Support in iOS and OS X

过期处理程序:beginBackgroundTaskWithExpirationHandler

我看不出有什么办法可以解决这个问题.

Objective-c相关问答推荐

如何限制 UITextField 中的特殊字符(点和下划线除外)?

NSInternalInconsistencyException', reason: '试图将第 0 行插入第 0 节,但更新后第 0 节只有 0 行'

用 UIActivityIndi​​catorView 替换 UIBarButtonItem

iOS 应用 Display Recorder 如何在不使用私有 API 的情况下录制屏幕?

iOS performSelectorOnMainThread 有多个参数

来自 NSString 的 NSJSONSerialization

setStatusBarHidden 在 iOS 9.0 中已弃用

Objective-C 属性的默认属性是什么?

如果用户禁用了应用程序的推送,是否可以进行静默远程通知?

Objective-C:如何使用 BOOL 类型的参数调用 performSelector?

iOS 7 - viewDidLoad 和 viewDidAppear 之间的区别

NSString:从字符串中删除 UTF-8 重音的简单方法?

在 iPhone 上测量人体胀气( Human-Flatulence)传播波包

未找到 RKObjectMapping.h

自定义 UISwitch 和 App Store 批准

UITableView configureCellForDisplay:forIndexPath 中的断言失败:

在 UICollectionView 上重置滚动

选中时选中的 UItableViewCell 保持蓝色

如何让 UITextView 检测网站、邮件和电话号码的链接

使用正则表达式查找/替换 NSString 中的子字符串