Persistent device identifier even after app gets u

2019-02-27 10:57发布

问题:

In my iPhone/iPad app's use case, there is a voting system and one device can send its vote once to the server. Therefore my server needs to identify user's device. I don't want the user to register an account because that makes the app complicate. However, I couldn't find a solution that works.

  • UDID is deprecated
  • I presume getting MAC address will get your app rejected by the app review process
  • I tried creating my own UUID using [[NSUUID UUID] UUIDString] and then storing it using NSUserDefaults, but the settings disappear if the user uninstalls the app
  • identifierForVendor is also reset when the user uninstalls the app
  • I considered advertisingIdentifier but because I'm not using it for advertisement, I presume it will also be rejected by the app review process

I'm not asking for a bulletproof solution in every situation. Just a solution that works even if the user uninstalls the app. Because I can generate my own UUID, I guess my question boils down to: How I can save data for the app that survives app uninstallation?

However if any of you have other approach, please feel free to inform me. Thanks.

回答1:

Save the UUID into the keychain.