iOS开发-使用KeyChain保存密码等信息

  • 最近使用了KeyChain实现保存密码等敏感信息的功能,使用了SAMKeychain,但是出现了保存密码信息失败的问题,最后在stackoverflow上找到了答案。

SAMKeychain setPassword is failing

NSLog(@"SETTING VALUE %@", value);
[SAMKeychain setPassword:value forService:SERVICE_NAME account:key];
NSLog(@"READING VALUE %@", [SAMKeychain passwordForService:SERVICE_NAME account:key]);

I am always getting (null) after setting a value. This wasn't happening before I updated XCode.
Does anyone has any idea what can be the problem?

The iOS 10 keychain has been buggy since the early beta of iOS 10. As a (hopefully temporary) workaround, enable the Shared Keychain entitlement in your app. This bug affects every keychain wrapper out there, and not only SAMKeychain.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容