kSecAttrAccessibleAlways deprecated in ios 9

穿精又带淫゛_ 提交于 2019-12-09 21:26:23

问题


I use keychain to authenticate and then send location info to server in background.

But since kSecAttrAccessibleAlways got depricated, I will have to use kSecAttrAccessibleAfterFirstUnlock. This allows use of keychain after first unlock after restarting phone.

Problem is if user restarts phone, and location changes before first unlock, then Authenticate will fail, since we can't fetch from keychain.

How can I solve this problem. How to find keychain cannot be accessed and stop authentication process.

Thanks.


回答1:


How would your app ever be running before the user first unlocks the device and launches it?

BTW, according to the latest docs, kSecAttrAccessibleAlways isn't deprecated. Maybe I'm missing something....




回答2:


This depends on your exact setup. For example, VoIP and region monitoring can auto launch the app before first unlock. Apple Watch enabled apps can start the phone app from background before the phone's first unlock. However, all other services including background fetch will not activate after restart of the phone until the user first enters their passcode so you are safe for those scenarios. But for region monitoring, a solution could be to change the functionality so that the user has to open the app once after first unlock to authenticate and send information to server. For example, cache the location data in the background and then when the user opens the app have it continue with the intended functionality.



来源:https://stackoverflow.com/questions/32112678/ksecattraccessiblealways-deprecated-in-ios-9

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