Reputation: 121
We need to uniquely identify the device and it has to be same across installs (reinstall). We have been using identifier stored in keychain till now so it persists across installs. Now with 10.3 beta the key chain is auto deleted when the app is uninstalled. Ref: https://forums.developer.apple.com/thread/72271
Can we use AdIdentifier as unique identifier. We have ads served and we are at the moment using it for the same.
Upvotes: 12
Views: 1519
Reputation: 130162
There seems to be a workaround. It's actually mentioned in the forum you linked.
By making the keychain item available to other apps you can ensure it won't be deleted when your app is deleted.
To do that, you can add the item to kSecAttrAccessGroupToken
access group on iOS 10. See https://gist.github.com/Raztor0/34ad0e23a410c33526c9fa1b6e8d281c
If you set the access group to this well-known group, your keychain item will be readable by all installed apps:
Every application has access to this access group so it is not needed to explicitly list it in keychain-access-groups entitlement, but application must explicitly state this access group in keychain queries in order to be able to access items from external tokens.
That makes the item unsuitable for any sensitive or secret data (e.g. passwords, user names etc). For a unique identification of devices this shouldn't matter.
Upvotes: 2
Reputation: 1264
Do you mean AdIdentifier as adverting identifier, aka IDFA? https://developer.apple.com/reference/adsupport/asidentifiermanager/1614151-advertisingidentifier
This value can be easily replaced by device holder from settings application. And also this value is all zeroes when the user has limited ad tracking.
Came up with the idea that using Cookie in the web browser (e.g. check cookie when first app launching and store unique string if it doesn't exist), but it can also be modified by users.
After all, I have no idea how completely identify unique user.
Upvotes: 1