目前,我们正在为我们公司开发跟踪应用程序。为了使这个应用程序更安全,我们想在首次启动时询问用户一个安全码。此安全代码很可能是客户编号。
用户使用他的跟踪和跟踪代码向服务器发送请求,服务器将检查安全代码和跟踪代码是否链接。
我的问题是将安全代码存储在应用程序中的最佳方式是什么,以便应用程序可以请求它,并将跟踪和跟踪发送到服务器。我们希望用户只在第一次启动时输入安全码。
[[NSUserDefaults standardUserDefaults] boolForKey:@"security code"];
这是一个选择吗?
最佳答案
对于您希望存储在设备上的任何安全数据,我强烈建议您使用钥匙串(keychain)。然后,您可以检查钥匙串(keychain)中是否存在代码,并在可用时使用它。
请参阅下面的文档,让您开始使用钥匙串(keychain)!
key 扣概念 https://developer.apple.com/library/ios/#documentation/security/Conceptual/keychainServConcepts/02concepts/concepts.html#//apple_ref/doc/uid/TP30000897-CH204-TP9
如何在 iOS 上实现 https://developer.apple.com/library/ios/#documentation/security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html
引用 https://developer.apple.com/library/ios/#documentation/security/Reference/keychainservices/Reference/reference.html#//apple_ref/doc/uid/TP30000898
示例项目 https://developer.apple.com/library/ios/#samplecode/GenericKeychain/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007797
关于iphone - IOS 应用程序的安全码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14519426/