identify each iphone device in iOS SDK

vietstone picture vietstone · Feb 23, 2012 · Viewed 11k times · Source

I need to determine each iOS device.

In the past SDKS, there's a way to identify UUID by the command

 [[UIDevice currentDevice] uniqueIdentifier];

But in iOS 5.0, this function is deprecated. Is there any way to do this similar task?

Thank you!

Answer

Alex Terente picture Alex Terente · Feb 23, 2012

uniqueIdentifier

An alphanumeric string unique to each device based on various hardware details. (read-only) (Deprecated in iOS 5.0. Instead, create a unique identifier specific to your app.) @property (nonatomic, readonly, retain) NSString *uniqueIdentifier Special Considerations

Do not use the uniqueIdentifier property. To create a unique identifier specific to your app, you can call the CFUUIDCreate function to create a UUID, and write it to the defaults database using the NSUserDefaults class. Availability

Available in iOS 2.0 and later.
Deprecated in iOS 5.0.

Related Sample Code

GKTank

Declared In UIDevice.h

So use CFUUIDCreate and you will get and uniqID and save it to the NSUDefaults.
Note that the CFUUIDCreate will give you a new id on each call. That is why you have to save it.

If you really need to know if the app was installed on that device you can read the mac address of the wifi card.