Toggling Privacy settings will kill the app

 ̄綄美尐妖づ 提交于 2019-12-17 04:54:59

问题


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:

Application 'UIKitApplication:com.myApp' exited abnormally with signal 9: Killed: 9

I can't find any information on this in Apple's documentation. Does anyone know a way to prevent this? Is this as designed? Or is this an Apple bug?


回答1:


the OS sends a SIGKILL which is not a crash - Apple session on privacy in iOS6 says:

  • If permissions changes, app is quit.
  • Background task expiration handler is called, if registered
  • iOS then kills the application.

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

Expiration handler: beginBackgroundTaskWithExpirationHandler

There is no way around this I can see.




回答2:


After testing beginBackgroundTaskWithExpirationHandler I can say that expiration handler block is not called after changing permission settings as stated in Apple presentation.



来源:https://stackoverflow.com/questions/12522574/toggling-privacy-settings-will-kill-the-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!