Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to identify an iDevice user?

I'm developing a native iOS app and I`m kind of newbie both to objective-C and apple device development.

In my app I need to identify the user by an unique way. I think that the best solution would be to obtain current Apple ID and store it in online database for my purposes. The only catch is that the user can change it. So, I`m thinking Apple has to have another identifier to uniquely distinguish the actual accounts.

Is there any way I can get that one? Something I missed? Some class?

Thanks in advance... Pete

like image 1000
Petr Mánek Avatar asked Dec 04 '22 18:12

Petr Mánek


1 Answers

All IOS devices have and Unique identifier UDID, wich is accesible through:

[[UIDevice currentDevice] uniqueIdentifier]

But this is discouraged by Apple and some apps are getting rejected by using this, basically because apple doesn't want you to track or treat devices as unique, because you can sell it or swap it with another person.

What you can do is to create a UUID which is a unique identifier and store it in the key chain, which means that this uniqueID will remain in the phone even if the app is deleted, it will only disappear when the you do a factory reset, which is what apple wants.

Another solution is to use external libraries that will generate uniqueID on a device basis like openUDID or UIDevice-with-UniqueIdentifier-for-iOS-5

Hope this helps!

like image 93
Ecarrion Avatar answered Dec 28 '22 20:12

Ecarrion