1

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!

vietstone
  • 8,784
  • 16
  • 52
  • 79

3 Answers3

3

For iOS 6 and latter you can use.

NSString *U_ID = [[NSUUID UUID] UUIDString];

Muhammad Rizwan
  • 3,470
  • 1
  • 27
  • 35
3

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.

Alex Terente
  • 12,006
  • 5
  • 51
  • 71
1

Please check the answer of @suchi here How to create a GUID/UUID using the iPhone SDK.

use [[UIDevice currentDevice] uniqueDeviceIdentifier] to retrieve the unique identifier (it's a hash of your Bundle ID + MAC address)

use [[UIDevice currentDevice] uniqueGlobalDeviceIdentifier] to retrieve a global unique identifier (it's a hash of the MAC address, used for tracking between different apps).

Community
  • 1
  • 1
Hiren
  • 12,720
  • 7
  • 52
  • 72