6

I am saving some data in the keychain, but after each application update that data are lost. The same problem I have when I save something in the user defaults. This is important because I use it to store created a unique identifier. What can be wrong? Thanks for any tips.

Bartosz Bialecki
  • 4,391
  • 10
  • 42
  • 64

3 Answers3

6

I had the same issue with our latest app. What we found out is that Apple apparently is wiping the data from Keychain for pre iOS 8 apps if the newer app has minimum supported version of 8.0. However if the minimum supported version is set to iOS 7.0, the Keychain data is not wiped off.

So apparently all apps using Keychain will face this issue when they set the minimum supported version to iOS 8.0 and push to AppStore.

Junaid EC
  • 61
  • 1
  • 3
2

Loss in keychain data may be due to change in the keychain-access-groups entitlement.

Keeping the same value for this key in old and new apps will solve the issue.

vesirak
  • 41
  • 3
0

I am facing the same issue. And my deployment target is iOS 10.

I am storing JWT token in keychain using -

A0SimpleKeychain().setString(token, forKey:"user-jwt")

And using the following to retrieve it back -

A0SimpleKeychain().string(forKey: key)

I am seeing in production logs that for some users, the token is not getting fetched from keychain after app upgrade. Is it iOS issue or anything I am missing out here. Please suggest.

Recently saw this issue on iOS 12.4.

I am using Simple Keychain for this.

Namit Gupta
  • 796
  • 9
  • 20
  • Namit, are able to fix this issue ? or still it is persist ? I am also facing same issue, but didn't find any reason for, I checked entitlements file for both versions and both are same. still facing same issue. – Bhavesh Patel Sep 04 '19 at 06:59
  • @BhaveshPatel I didn't found anything yet. Let me know if you find anything. – Namit Gupta Sep 04 '19 at 07:29
  • Incase of changes in entitlement file cause the resetting of Key-Chain data and there are many things which we change and it change the entitlement file like change in Capabilities, provisioning profile resigning, etc. So might be change in entitlement file has cause the resetting of Key-Chain data. – Bhavesh Patel Sep 05 '19 at 05:41