Keychain data lost after updating the app on iOS
Asked Answered
B

3

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.

Bilocular answered 3/12, 2012 at 9:35 Comment(2)
I wonder if it is this problem : #8054785Macmacabre
I don't use that wrapper, so this is not the problem.Bilocular
O
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.

Obnubilate answered 30/9, 2015 at 21:51 Comment(0)
B
3

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.

Beefwood answered 23/6, 2020 at 6:45 Comment(0)
L
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.

Linis answered 17/8, 2019 at 14:47 Comment(3)
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.Selwin
@BhaveshPatel I didn't found anything yet. Let me know if you find anything.Linis
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.Selwin

© 2022 - 2024 — McMap. All rights reserved.