我一直在一个应用程序中工作,这个应用程序需要使用一个唯一的ID,负责与服务器连接以进行同步。如果此ID发生更改,我的应用程序将失去连接,所有重要数据都将丢失。
现在我正在使用"identifierForVendor",但这在某些情况下似乎没有用处。它在我下面提到的某些情况下发生了变化,请检查并提出一些建议来克服这个问题。
"identifierForVendor" getting changed in the condition:
1) Delete app and then reinstalled again using different vendor (always).
2) Delete app and then reinstalled again using even same vendor (random).
3) iOS and xCode update (xCode-7.3/iOS-9.3)(not sure about frequency but on my last update its changed).
请帮帮我。
是的,identifierForVendor
在某些情况下可能会更改。
因此,您可以使用SSKeychain
将您的unique ID
存储在KeyChain中。
将SSKeychain.h, SSKeychain.m, SSKeychainQuery.h and SSKeychainQuery.m
文件导入到项目中。
添加CCD_ 5。
保存唯一ID:
[SSKeychain setPassword:@"AnyID" forService:@"AnyService" account:@"AnyUser"]
检索唯一ID:
NSString *UniqueID = [SSKeychain passwordForService:@"AnyService" account:@"AnyUser"];
编辑(如DarkDust所建议):
下载SSKeychain
:https://github.com/soffes/SSKeychain