Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a long-term method I can use to uniquely identify an iOS device?

What is the best way to uniquely register an iOS Device, which won't be limited by future Apple restrictions?

My current approach to register an iOS device (basically to identify the device uniquely) is that I use the UDID of an iOS device to identify it and register it, and then after recognising it I perform the necessary actions.

The issue is that the UIDevice uniqueIdentifier property is deprecated. There are certain workarounds for that (as discussed in this question) which I'm aware of.

One possibility is to use the MAC address of an iOS device. However, I feel that Apple may restrict access to this information at some point in the future, as well.

Is there any other way (besides accessing the MAC address) to identify an iOS device, which we can rely on for the future?

like image 446
rishi Avatar asked Apr 25 '12 15:04

rishi


People also ask

How do I know which iOS device is unique?

UDID(Unique Device Identifier) − A sequence of 40 hexadecimal characters that uniquely identify an iOS device. Since from iOS 5, Apple has deprecated the UIDevice unique identifier, that means the traditional way of getting the unique id.

How can you identify a uniquely device?

So, you can easily retrieve an unique ID identifying the device. This unique ID can be IMEI, MEID, ESN or IMSI. They can be defined as follows: IMEI for International Mobile Equipment Identity: the Unique Number to identify GSM, WCDMA mobile phones as well as some satellite phones.

What is iOS device identifier?

Every Apple iPhone, iPod touch and iPad has a unique device ID number associated with it, known as a Unique Device ID (UDID). Apple's device ID is a 40-digit sequence of letters and numbers. Customers can access their device ID numbers in iTunes or by downloading a free app from the Apple App Store.


2 Answers

Using Apple's preferred method of generating a CFUUIDRef is probably the better solution as I feel the MAC address may be removed in the future as well. If you use this and save it to your NSUserdefaults you will have it persist unless the user deletes the app. If you want to have a generated unique ID that you can share between apps or persist between installs you should look at using the UIPasteboard and saving your generated UID with a key that you share between apps.

//Create a unique id as a string
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);

//create a new pasteboard with a unique identifier
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"youruniquestring" create:YES];

[pasteboard setPersistent:YES];

//save the unique identifier string that we created earlier
[pasteboard setString:((__bridge NSString*)string)];


 //accessing it
UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"youruniquestring" create:NO];
NSLog([pasteboard string]);

I have written a brief tutorial here but its basically the lines above: http://www.roostersoftstudios.com/2012/03/26/a-way-to-share-data-between-apps-on-a-given-ios-device/

like image 160
rooster117 Avatar answered Oct 01 '22 13:10

rooster117


Unless your application is for managing my Apple devices, it is the wrong approach. As a user, I don't want you to know which device I'm using. I want you to recognize me, whatever the device I use. I want to be able to replace a defective device. Apple will restrict more and more the access to this information.

[edit] I can't see how a MAC address could work. My iOS devices can have multiple.

like image 21
Stephan Eggermont Avatar answered Oct 01 '22 12:10

Stephan Eggermont