Reputation: 183
I am using UUID to get Unique code from iOS Devices but while uninstalling or deleting and re-installing id Changed.. Suggest Without saving to Keychain and ASIdentifierManager.
let deviceId = (UIDevice.current.identifierForVendor?.uuidString)!
But in android - ANDROID_ID working fine
Note :Keeping the apple privacy and security
Upvotes: 2
Views: 682
Reputation: 554
Addition @sagar's answer which yes UUID is unique for app every install basis. but you may want to use UDID which unique for everydevice. You can check also this answer from another question. it explains better. It might help.
Upvotes: 0
Reputation: 93
You can store UUID in SSKeychain which will be there forever. See the below code:
class func createUUID() -> String
{
let appName = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String
var strApplicationUUID = SSKeychain.password(forService: appName, account: "incoding")
if strApplicationUUID == nil {
strApplicationUUID = UIDevice.current.identifierForVendor!.uuidString
SSKeychain.setPassword(strApplicationUUID, forService: appName, account: "incoding")
}
return strApplicationUUID!
}
Upvotes: 1
Reputation: 657
when app is uninstall and install new app then you get unique code is different that also define in documentation of apple.
you may try
let UUID = NSUUID.UUID().UUIDString
for unique uuid Code.
Upvotes: 0