问题
Possible Duplicate:
UIDevice uniqueIdentifier Deprecated - What To Do Now?
I know there have been quite a few questions on SO about this, but I think that because Apple is moving ahead of schedule and actively denying applications that make use of UDIDs (http://pulse.me/s/7mzKE), us developers need to take an active approach and discuss this matter in bulk.
So the question is - what is a good, stable and correct alternative for unique device identification, other than accessing it's UDID property?
回答1:
This depends on your needs...if you're looking for a simple device identifier for your application to use, then the documentation on the deprecated uniqueIdentifier
method pretty much provides your answer:
Do not use the uniqueIdentifier property. To create a unique identifier specific to your app, you can call the
CFUUIDCreate
function to create a UUID, and write it to the defaults database using theNSUserDefaults
class.
CFUUIDCreate
will return a unique handset identifier that is unique to your application. You need to store it in NSUserDefaults
because it will change if you make subsequent calls. For most uses this will suffice, and it's not as if Apple didn't provide enough warning of this change (iOS 5 has been out for over six months now, and the developer docs for longer).
The other scenario is where you need to share your device identifier across applications (ie, mobile advertising networks). That's a more complex problem, with a number of alternative options (there's also no guarantee they'll remain around in the future: Apple's primary reason for deprecating the UDID API is presumably to stop cross application user tracking).
回答2:
My personal favorite is OpenUDID.
You can grab the GitHub here.
I've summarized my thoughts and put a brief description of it here.
回答3:
SecureUDID, based on OpenUDID but more secure, accessible by domain only (and salt)
More info.
回答4:
One of a devices 2 or 3 MAC address is already exposed by the protocol specification during any wireless communication.
回答5:
While I think this is not a typical "how do I overcome this particular technical challenge" I agree it is wildly important and could be well discussed in SO somehow (not sure - wiki? Forum?). I'd be interested to know whether there are discussions in how Flurry beat this.
来源:https://stackoverflow.com/questions/9858850/an-alternative-to-the-device-udid-preparing-ourselves