In my iOS app, I have to restrict the user to use iOS app per device. To do this I found a solution that we can use the identifierForVendor method of UUID (Universally Unique Identifier)
which will generate a unique ID to uniquely identify an app on a device. (Here, I am not using UDID (Unique Device Identifier)
because Apple rejects apps if the app uses UDID).
So my question as is there any possibilities that the two devices will have the same UUID
. any idea?
EDIT 1:
I have one more doubt as if I installed the same app on different two devices and save its UUID
string into the device KeyChain
. Both devices have same iCloud
account. Now while doing iCloud
sync for this two devices, is one my device KeyChain
will gets overwritten?
EDIT 2:
I have found answer for EDIT 1 as 'Yes, through iCloud Keychain
, the keychain
would be synced to another one of my devices, and I’d get the same device identifier from here and from below answer too'
For the item to be synced with iCloud keychain
, I’d need to explicitly set the kSecAttrSynchronizable
attribute. Using the SecItem
API, we can set this attribute while adding a keychain item.
Is there any tutorial how to add item in Keychain
(Without third party libraries)?
No, Two device does not have the same
UUID
. I am 100% Sure about it. So go withidentifierForVendor
method.But, The
UUID
may be changed when you reinstall the the application in your device (If there is not other application for the same vendor).EDIT
YOUR QUESTION
I have one more doubt as if I installed the same app on different two devices and save its UUID string into the device KeyChain. Both devices have same iCloud account. Now while doing iCloud sync for this two devices, is one my device KeyChain will gets overwritten?
ANSWER
YES. Your keychain will gets overwritten. So you have same UUID for both 2 devices.