Search code examples
iosudid

Using String for Referral Program iOS


I'm trying to create a campaign where a user can apply a credit to their device. I want to prevent account creation spamming by returning a unique string that will never change regardless of whether a user deletes the app, etc.

What is the best practice way of achieving this? I found the ASIdentifierManager class but that doesn't seem appropriate (as apps are rejected for including this class without actually including ad support supposedly). identifierForVendor from UIDevice class changes upon every app deletion, which seems useless to me.

This doesn't have to be the device's actual UDID, or the same across other apps, just a string that stays constant regardless of app deletion and reinstallation.


Solution

  • One way is to write a UUID to the keychain. That will survive app deletion.