I want to generate a device specific random uuid which does not change even if the user uninstalls all my apps and reinstall unlike identifierforvendor. How can I achieve this is Swift
2 Answers
You can use the following function for creating the UUID:
func getUniqueDeviceIdentifierAsString() -> String { var appName: String? = (Bundle.main.infoDictionary?[(kCFBundleNameKey as? String)] as? String) var strApplicationUUID: String = SSKeychain.password(forService: appName, account: "incoding") if strApplicationUUID == nil { strApplicationUUID = UIDevice.current.identifierForVendor.uuidString SSKeychain.setPassword(strApplicationUUID, forService: appName, account: "incoding") } return strApplicationUUID } reference :How to preserve identifierForVendor in ios after uninstalling ios app on device?
Comments
You need to create random UUID and save it to keychain. Try below link