Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A UUID created by <code>CFUUIDCreate</code> <em>is</em> unique if a user uninstalls and re-installs the app: you will get a new one each time.</p> <p><strike>But you might want it to be <em>not</em> unique, i. e. it should stay the same when the user uninstalls and re-installs the app. This requires a bit of effort, since the most reliable per-device-identifier seems to be the MAC address. You could <a href="https://stackoverflow.com/questions/677530/how-can-i-programmatically-get-the-mac-address-of-an-iphone">query the MAC</a> and use that as UUID.</p> <p><strong>Edit:</strong> One needs to always query the MAC of the same interface, of course. I guess the best bet is with <code>en0</code>. The MAC is always present, even if the interface has no IP/is down.</strike></p> <p><strong>Edit 2:</strong> As was pointed out by others, the preferred solution since iOS 6 is <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor" rel="noreferrer">-[UIDevice identifierForVendor]</a>. In most cases, you should be able use it as a drop-in replacement to the old <code>-[UIDevice uniqueIdentifier]</code> (but a UUID that is created when the app starts for the first time is what Apple seems to want you to use).</p> <p><strike><strong>Edit 3:</strong> So this major point doesn't get lost in the comment noise: do not use the <em>MAC</em> as UUID, create a <em>hash using the MAC</em>. That hash will always create the same result every time, even across reinstalls and apps (if the hashing is done in the same way). Anyways, nowadays (2013) this isn't necessary any more except if you need a "stable" device identifier on iOS &lt; 6.0.</strike></p> <p><strong>Edit 4:</strong> In iOS 7, Apple now always returns a fixed value when querying the MAC to specifically thwart the <em>MAC as base for an ID</em> scheme. So you now really should use <a href="http://developer.apple.com/library/ios/documentation/uikit/reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor" rel="noreferrer">-[UIDevice identifierForVendor]</a> or create a per-install UUID.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload