UIDevice uniqueIdentifier Deprecated - What To Do Now?

A UUID created by CFUUIDCreate is unique if a user uninstalls and re-installs the app: you will get a new one each time.

A UUID created by CFUUIDCreate is unique if a user uninstalls and re-installs the app: you will get a new one each time. But you might want it to be not unique, i. E.It should stay the same when the user uninstalls and re-installs the app.

This requires a bit of effort, since the most reliable per-device-identifier seems to be the MAC address. You could query the MAC and use that as UUID. Edit: One needs to always query the MAC of the same interface, of course.

I guess the best bet is with en0. The MAC is always present, even if the interface has no IP/is down.

– HaggleLad Aug 9 at 8:46 No, the IP does, but not the MAC. The MAC is unique to the interface. – DarkDust Aug 9 at 8:52 10 Thanks very much sir, I'm accepting this answer, a colleague has tried this out and its working successfully.

However I would like to emphasise that we have implemented a new getDeviceId method that returns a 44-byte string that is a salted, hashed and base64-encoded version of the MAC. Its not a good idea to be passing the users MAC around willy-nilly. – HaggleLad Aug 11 at 8:09 @HaggleLad: Very good point about privacy, hashing the MAC really is a good idea.

– DarkDust Aug 11 at 8:24 1 I disagree with this solution as the whole answer, since what you really want is a UUID that stays the same across application runs, not just on one device. To that end I would generate the UUID in some way (perhaps this MAC technique) but then store in locally in an iCloud key/value store, that you could look for on application runs. Then a user switching devices would keep the same login, and even better if a user sold their phone someone else would not be seeing their data (which is I think why Apple is shutting off the UUID).

– Kendall Helmstetter Gelner Oct 30 at 18:49.

You can use your alternative for Apple UDID already. Kind guy kekitz wrote category on UIDevice which will generate some kind of UDID based on device mac-address and bundle identifier. You can find code on github.

1 This implementation is unique (MAC address) for a device across reinstallations, like Apple's uniqueId, but also respect privacy, being also unique for an application (also use bundleId)... A must have imho, that Apple should include in its APIs... instead of deprecating w/o any alternatives. – Vincent G Aug 22 at 8:45 2 Although it uses the old style bsd license with the advertising clause, yuck. – jbtule Sep 29 at 0:06.

Based on the link proposed by @moonlight, I did several tests and it seems to be the best solution. As @DarkDust says the method goes to check en0 which is always available. There are 2 options: uniqueDeviceIdentifier (MD5 of the MAC) and uniqueGlobalDeviceIdentifier(MD5 of MAC+CFBundleIdentifier), these always returns the same values.

Below the tests i've done (with the real device): #import "UIDevice+IdentifierAddition. H" NSLog(@"%@",UIDevice currentDevice uniqueDeviceIdentifier); NSLog(@"%@",UIDevice currentDevice uniqueGlobalDeviceIdentifier); XXXX21f1f19edff198e2a2356bf4XXXX - (WIFI)UDID XXXX7dc3c577446a2bcbd77935bdXXXX - (WIFI)GlobalAppUDID XXXX21f1f19edff198e2a2356bf4XXXX - (3G)UDID XXXX7dc3c577446a2bcbd77935bdXXXX - (3G)GlobalAppUDID XXXX21f1f19edff198e2a2356bf4XXXX - (GPRS)UDID XXXX7dc3c577446a2bcbd77935bdXXXX - (GPRS)GlobalAppUDID XXXX21f1f19edff198e2a2356bf4XXXX - (AirPlane mode)UDID XXXX7dc3c577446a2bcbd77935bdXXXX - (AirPlane mode)GlobalAppUDID XXXX21f1f19edff198e2a2356bf4XXXX - (Wi-Fi)after removing and reinstalling the app XXXX7dc3c577446a2bcbd77935bdXXXX (Wi-Fi) after removing and installing the app Hope it's useful.

The MAC address can be spoofed which makes such an approach useless for tying content to specific users or implementing security features like blacklists. After some further research it appears to me that we're left without a proper alternative as of now. I seriously hope Apple will reconsider their decision.

Maybe it would be a good idea to email Apple about this topic and / or file a bug / feature request on this since maybe they are not even aware of the full consequences for developers.

7 A valid point however I believe the UUID can also be spoofed/swizzled on a jailbroken phone so technically the existing UIDevice uniqueIdentifier is just as flawed. – HaggleLad Aug 11 at 8:11.

I would also suggest changing over from uniqueIdentifier to this open source library (2 simple categories really) that utilize the device’s MAC Address along with the App Bundle Identifier to generate a unique ID in your applications that can be used as a UDID replacement. Keep in mind that unlike the UDID this number will be different for every app. You simply need to import the included NSString and UIDevice categories and call UIDevice currentDevice uniqueDeviceIdentifier like so: #import "UIDevice+IdentifierAddition.

H" #import "NSString+MD5Addition. H" NSString *iosFiveUDID = UIDevice currentDevice uniqueDeviceIdentifier You can find it on Github here: https://github. Com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5 Here are the categories (just the .

M files - check the github project for the headers): UIDevice+IdentifierAddition. M #import "UIDevice+IdentifierAddition. H" #import "NSString+MD5Addition.

H" #include // Per msqr #include #include #include @interface UIDevice(Private) - (NSString *) macaddress; @end @implementation UIDevice (IdentifierAddition) //////////////////////////////////////////////////////////////////////////////// #pragma mark - #pragma mark Private Methods // Return the local MAC addy // Courtesy of FreeBSD hackers email list // Accidentally munged during previous update. Fixed thanks to erica sadun & mlamb. - (NSString *) macaddress{ Â Â Â Â Â Â Â Â int mib6; Â Â Â Â size_t len; Â Â Â Â char *buf; Â Â Â Â unsigned char *ptr; Â Â Â Â struct if_msghdr *ifm; Â Â Â Â struct sockaddr_dl *sdl; Â Â Â Â Â Â Â Â mib0 = CTL_NET; Â Â Â Â mib1 = AF_ROUTE; Â Â Â Â mib2 = 0; Â Â Â Â mib3 = AF_LINK; Â Â Â Â mib4 = NET_RT_IFLIST; Â Â Â Â Â Â Â Â if ((mib5 = if_nametoindex("en0")) == 0) { Â Â Â Â Â Â Â Â printf("Error: if_nametoindex error\n"); Â Â Â Â Â Â Â Â return NULL; Â Â Â Â } Â Â Â Â Â Â Â Â if (sysctl(mib, 6, NULL, &len, NULL, 0) @implementation NSString(MD5Addition) - (NSString *) stringFromMD5{ Â Â Â Â Â Â Â Â if(self == nil || self length == 0) Â Â Â Â Â Â Â Â return nil; Â Â Â Â Â Â Â Â const char *value = self UTF8String; Â Â Â Â Â Â Â Â unsigned char outputBufferCC_MD5_DIGEST_LENGTH; Â Â Â Â CC_MD5(value, strlen(value), outputBuffer); Â Â Â Â Â Â Â Â NSMutableString *outputString = NSMutableString alloc initWithCapacity:CC_MD5_DIGEST_LENGTH * 2; Â Â Â Â for(NSInteger count = 0; count.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions