5

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??

ayl
  • 384
  • 1
  • 5
  • 14
  • Keychain data is never purged automatically, it has to be an explicit action. It can be done by either restoring the device, or deleting the value yourself. If it's neither of these, ensure your search query is able to find the value. – WDUK May 30 '14 at 09:31

2 Answers2

0

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.

Aditya Sinha
  • 103
  • 6
0

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

Community
  • 1
  • 1
Antonio Romano
  • 285
  • 3
  • 13