gpt4 book ai didi

ios - SSKeychain 不保留数据

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:03:21 26 4
gpt4 key购买 nike

我正在使用 SSKeychain 来存储设备的 UUID。但是,有时 SSKeychain 不保留 UUID,因此我的应用程序必须重新创建新的 UUID。谁能告诉我 SSKeychain 不保留数据的一些原因。

提前致谢!

对不起我的英语:)

最佳答案

在你的 appdelegates 中为 Objective C 试试这个

NSString *uniqueId = [SSKeychain passwordForService:@"YOUR_PROJECT_IDENTIFIER" account:@"unique_id"];

if ([uniqueId length]==0)
{
uniqueId = [AppDelegate uuid];
[SSKeychain setPassword:uniqueId forService:@"Store credentials in Keychain Identifier" account:@"unique_id"];
}
[[NSUserDefaults standardUserDefaults] setValue:uniqueId forKey:@"iPhoneUniqueID"];
NSLog(@"Device_ID:%@",uniqueId);

关于ios - SSKeychain 不保留数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39990629/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com