Possible Duplicate:
UIDevice uniqueIdentifier Deprecated - What To Do Now?
As I expect you are aware of, the uniqueIdentifier
in UIDevice
is deprecated in iOS5. What I am looking for a basically the same functionality for iOS5.
What I understand from the documentation is that apple wishes that we (developers) create our own UUID (using CFUUIDCreate
I guess) and store it in the NSUserDefaults
. This, however, makes me shiver a bit and does not at all feel save. Feels a bit pointless to have a UUID in this case.
The reason I need an UUID is because I send of a bunch information including UUID to my servers in the auth process and would like to be able to skip some steps if the server can "guess" whom the user is next time the app gets launched or re-installed or another app implements my library. CFUUIDCreate
does not seem to help me with this.
I took a quick look at gekitz as well, but as I understand it, it bases it solely on the MAC address of the Ethernet "card" in the phone. This is not suitable since I have a vague feeling that the MAC address is changeable. The uniqueIdentifier
in UIDevice
was
An alphanumeric string unique to each device based on various hardware details.
Currenly I wrote this code, which retrieves a UUID. But as soon as I clean in XCode and re-install the app on the phone, I get a new UUID.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *UUID = @"";
if (![defaults valueForKey:@"UUID"])
{
CFUUIDRef UUIDRef = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef UUIDSRef = CFUUIDCreateString(kCFAllocatorDefault, UUIDRef);
UUID = [NSString stringWithFormat:@"%@", UUIDSRef];
[defaults setObject:UUID forKey:@"UUID"];
}
else {
UUID = [defaults valueForKey:@"UUID"];
}
[deviceInformation setObject:UUID forKey:@"UUID"];
To sum it up, my question is the following:
Is there some solid way of creating an UUID that is based upon the device which is "hard" to tamper with and gives me as receiver a little something to depend and trust upon? This does not have to be based on the device, may be based on the app as a App UUID as long as its the same after a re-installation.
CFUUIDCreate
, stored withNSUserDefaults
, not satisfy your authentication use case ? Each installation would always send the same value (until it would get deleted and reinstalled). It may be annoying while developing, but a user doesn't delete his apps very often, does he ? – Carthage