iOS Keychain Data Lost Upon iPhone Memory Pressure?

☆樱花仙子☆ 提交于 2019-12-12 12:11:11

问题


I'm running an iOS app via a debugger on my iPhone 5s. I'm using the keychain to store a password (I'm using the KeychainItemWrapper example from Apple to store and retrieve my keychain items). About 99.99% of the time, the keychain retrieval works perfectly. However, there have been two cases in which my application could not get the password. For example, once, my phone was experiencing memory pressure and I had to restart the phone and relaunch the app. Upon the app relaunch, my app could no longer retrieve the password from the keychain. I wonder if this password loss was caused by this memory pressure? What other cases does iOS purge keychain data? Is there any way to present this??


回答1:


iOS keychain is very much unrelated with your app's memory pressure.

There could be 2 scenarios:

  1. Somehow you happen to reset your phone - Keychain data would be lost (unless your keychain is synced with icloud).
  2. You somehow called resetKeychainItem from your wrapper.

Can't help more without having a look at your code.




回答2:


You could probably not found the value temporary, as you can see in this question: KeychainItemWrapper not getting loaded on iOS 9 OSStatus -34018 (errSecMissingEntitlement) and the related question on apple's forum: https://forums.developer.apple.com/thread/4743



来源:https://stackoverflow.com/questions/23949589/ios-keychain-data-lost-upon-iphone-memory-pressure

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