-->

Retrieving UDID via private API

2019-02-18 07:30发布

问题:

I'm looking for a way to retrieve the UDID on devices running iOS 6+ (Enterprise deployment only - no app store limitations).

Calling the (now private) method uniqueIdentifier returns the 'vendorIdentifier' starting with 'FFFFFFF'. Unfortunately thats not what I want.

Any ideas? Is there another private method or something?

Thanks in advance.

回答1:

I recommend you reading this article. To sum up:

  • The previously deprecated uniqueIdentifier now works like vendorIdentifier on iOS 7+, so it's no longer usable even for Enterprise Apps
  • OpenUDID cannot be shared between Applications on iOS 7+ and now can change. It's still usable but no longer recommended.
  • The vendorIdentifier hasn't changed, but it's not recommended for Enterprise Apps because it can change when updating the App.
  • The new advertisingIdentifier API is the way to go for new Apps. It's the same for all Apps and should not change frequently, but the user can reset it in the settings page.

Edit: Website udid.io obtains the real Device UDID instead of the obfuscated one if you need it for anything outside your App. If you need the UDID from within the App, see my answer above.



回答2:

You can get a Unique UDID via this method using private api. Follow this link Look for the code in accepted answer.



回答3:

Sorry, but Apple warned it would be deprecated and it has been. I've had the same headache myself.

I can't help you identify the device in the same way Apple do, but you can always generate an unique UUID on app launch and stash that away in KeyChain. It won't be perfect, but it will persist between installations and will be unique to the device. As far as I know, that's the current solution