问题
In my iOS app, I have to restrict the user to use iOS app per device. To do this I found a solution that we can use the UUID (Universally Unique Identifier)
or UDID (Unique Device Identifier)
. But according to this answer I can't use UUID, because if app gets deleted or reinstalled UUID
has been getting changed and I don't want this. Also Apple rejects apps if app uses UDID
.
Is there any way to identify iOS device uniquely.
回答1:
Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification. Source: TNW
What you are looking for is Vendor ID
回答2:
I'm using this library for my projects, and it's working like a charm, please try :
https://github.com/blackpixel/BPXLUUIDHandler
easy to use :
Import BPXLUUIDHandler.h Retrieve the UUID with
[BPXLUUIDHandler UUID]
Thats all...
Here is some info from project's github page :
As of iOS 5, Apple has deprecated the device unique identifier api and hasn’t provided a friendly Obj-C replacement, instead recommending CFUUIDCreate and NSUserDefaults.
CFUUIDCreate isn’t very complicated and neither is NSUserDefaults, but this solution fails in a few different ways:
- It’s not a quick one-shot call to get the UUID; you have to write your own wrapper to make it friendly
- It doesn’t persist; deleting the app blows away the UUID (can be persisted if stored in the keychain though)
- There’s no way to share it between apps
来源:https://stackoverflow.com/questions/30936371/how-to-identify-ios-device-uniquely-instead-of-using-uuid-and-udid