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
            Asked
            
        
        
            Active
            
        
            Viewed 906 times
        
    2 Answers
2
            
            
        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?
 
    
    
        Community
        
- 1
- 1
 
    
    
        Aashish1aug
        
- 795
- 1
- 8
- 22
 
     
    