Device UUID not unique when user uninstall and re-install

后端 未结 2 1010
长发绾君心
长发绾君心 2021-01-03 10:39

I have a system where each user allowed to install apps for two devices only. The issue is happened when user uninstall and reinstall again on the same device. So it will ge

2条回答
  •  执笔经年
    2021-01-03 11:01

    This is the expected bevaiour. If you want to use same UUID you need to save it to the keyChain. I have done something simmiler in of my apps using KeyChainWrapper

    So here is a sample chunk for you

    let deviceId = UIDevice.currentDevice().identifierForVendor?.UUIDString ?? ""
    // Saving Id in keyChain
    KeychainWrapper.defaultKeychainWrapper().setString(deviceId, forKey: "CurrentDeviceId")
    

    And then just get Id from keyChain everytime you want to use it.

    let previousDeviceId = KeychainWrapper.defaultKeychainWrapper().stringForKey("CurrentDeviceId")
    

提交回复
热议问题