Why did my unique device ID change?

ε祈祈猫儿з 提交于 2020-01-22 10:33:09

问题


I have been using the following method for around a month with no problem. The device ID remained the same even after uninstalls of the app. Recently I noticed that my device ID changed. I have been doing a lot of builds of the app recently on Xcode6. Could this be a cause? I wish I knew exactly when it changed. It caught me by surprise. Do I have anything to worry about when the app goes on the app store? Maybe this is just an Xcode build problem? I am just looking for a simple way to guarantee a unique device ID. I would use advertisingIdentifer but I hear using it for purpose other then advertisements will get rejected by app store. Here is the code:

+ (NSString *)getUserID
{
    NSString *Appname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
    NSString *retrieveuuid = [SSKeychain passwordForService:Appname account:@"user"];

    if(retrieveuuid == NULL)
    {
        CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault);
        retrieveuuid = (__bridge_transfer NSString*)CFUUIDCreateString(kCFAllocatorDefault, newUniqueId);
        CFRelease(newUniqueId);
        [SSKeychain setPassword:retrieveuuid forService:Appname account:@"user"];
    }

    NSLog(@"%@", retrieveuuid);
    return retrieveuuid;
}

回答1:


The unique device id does not persist This has been asked many times before and you should find some good info on here. A quick Google search brings up the following.

https://stackoverflow.com/search?q=iOS+UDID+replacement

Persistent UDID equivalent for iOS 7?

UIDevice uniqueIdentifier Deprecated - What To Do Now?

iOS unique user identifier

general advice is to use CFUUID to create your own UUID, then persist it in the keychain



来源:https://stackoverflow.com/questions/27276645/why-did-my-unique-device-id-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!