How to create a good, non-changing UDID on iPhone

In iOS 5, the use of [[UIDevice currentDevice] uniqueIdentifier] is deprecated. Now we are invited to use our own generated UUIDs and store them in the NSDefaults application. This is normal for most users, I think.

But my question is: is it possible to somehow generate a UUID that will behave like a device identifier? I would like to keep it the same even after uninstalling and reinstalling the application. The goal of this is to help keep track of possible fraud attempts taken from the iPhone.

I am wondering if using a MAC address will be like in this category: https://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m , is everything all right?

+4
source share
2 answers

A discussion of the uniqueIdentifier property in the documentation states:

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

Writing it by default should ensure that it will be saved if the application is uninstalled / reinstalled. I would think.

Edit:

Sorry, they are not saved when you uninstall the application . The documentation describes how to generate a UUID, but I cannot find out if it is persistent for a given user / device. I have seen some people suggest using keychain for persistence when uninstalling / reinstalling the application, but they don’t know how much it is recommended (and in any case, the user can, I suppose, delete entries).

+2
source

Create your own UUID using the method described by Apple (the one specified by jbat), store it in NSUserDefaults.

Using iCloud, you can use the keystore to help β€œsave” this UUID to a specific user, between installations and different devices.

0
source

Source: https://habr.com/ru/post/1382479/


All Articles