简体   繁体   English

在 iOS 上更新应用程序后钥匙串数据丢失

[英]Keychain data lost after updating the app on iOS

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.感谢您提供任何提示。

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.我们发现,如果较新的应用程序支持的最低版本为 8.0,那么 Apple 显然会从 Keychain 中擦除 iOS 8 之前应用程序的数据。 However if the minimum supported version is set to iOS 7.0, the Keychain data is not wiped off.但是,如果将支持的最低版本设置为 iOS 7.0,则不会擦除 Keychain 数据。

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.因此,显然所有使用 Keychain 的应用在将最低支持版本设置为 iOS 8.0 并推送到 AppStore 时都会面临这个问题。

Loss in keychain data may be due to change in the keychain-access-groups entitlement.钥匙串数据丢失可能是由于keychain-access-groups权利的变化。

Keeping the same value for this key in old and new apps will solve the issue.在旧的和新的应用程序中为这个键保持相同的值将解决这个问题。

I am facing the same issue.我面临同样的问题。 And my deployment target is iOS 10.我的部署目标是 iOS 10。

I am storing JWT token in keychain using -我正在使用 - 在钥匙串中存储 JWT 令牌

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.是 iOS 问题还是我在这里遗漏的任何问题。 Please suggest.请建议。

Recently saw this issue on iOS 12.4.最近在 iOS 12.4 上看到了这个问题。

I am using Simple Keychain for this.我为此使用了简单的钥匙串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM