Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>uniqueIdentifier (Deprecated in iOS 5.0. Instead, create a unique identifier specific to your app.)</p> </blockquote> <p>The docs recommend use of <a href="https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFUUIDRef/Reference/reference.html#//apple_ref/c/func/CFUUIDCreate" rel="nofollow noreferrer">CFUUIDCreate</a> instead of <code>[[UIDevice currentDevice] uniqueIdentifier]</code></p> <p>So here is how you generate an unique id in your app</p> <pre><code>CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault); NSString *uuidString = (NSString *)CFUUIDCreateString(NULL,uuidRef); CFRelease(uuidRef); </code></pre> <p>Note that you have to save the uuidString in user defaults or in other place because you can not generate the same uuidString again.</p> <p>You can use <a href="https://developer.apple.com/library/ios/#documentation/uikit/reference/UIPasteboard_Class/Reference.html" rel="nofollow noreferrer">UIPasteboard</a> to store your generated uuid. And if the app will be deleted and reinstalled you can read from UIPasteboard the old uuid. The paste board will be wiped out when the device will be erased.</p> <p>In iOS 6 they have introduced the <a href="https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSUUID_Class/Reference/Reference.html" rel="nofollow noreferrer">NSUUID Class</a> that is designed to create UUIDs strings</p> <p>Also they added in iOS 6 <code>@property(nonatomic, readonly, retain) NSUUID *identifierForVendor</code> to the <a href="https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/identifierForVendor" rel="nofollow noreferrer">UIDevice</a> class</p> <blockquote> <p>The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.</p> <p>The value of this property may be nil if the app is running in the background, before the user has unlocked the device the first time after the device has been restarted. If the value is nil, wait and get the value again later.</p> </blockquote> <p>Also in iOS 6 you can use <a href="https://developer.apple.com/library/ios/#documentation/AdSupport/Reference/ASIdentifierManager_Ref/ASIdentifierManager.html#//apple_ref/doc/uid/TP40012654" rel="nofollow noreferrer">ASIdentifierManager</a> class from AdSupport.framework. There you have </p> <pre><code>@property(nonatomic, readonly) NSUUID *advertisingIdentifier </code></pre> <blockquote> <p>Discussion Unlike the identifierForVendor property of the UIDevice, the same value is returned to all vendors. This identifier may change—for example, if the user erases the device—so you should not cache it.</p> <p>The value of this property may be nil if the app is running in the background, before the user has unlocked the device the first time after the device has been restarted. If the value is nil, wait and get the value again later.</p> </blockquote> <p>Edit:</p> <p>Pay attention that the <code>advertisingIdentifier</code> may return </p> <blockquote> <p>00000000-0000-0000-0000-000000000000</p> </blockquote> <p>because there seems to be a bug in iOS. Related question: <a href="https://stackoverflow.com/questions/12605257/the-advertisingidentifier-and-identifierforvendor-return-00000000-0000-0000-000">The advertisingIdentifier and identifierForVendor return &quot;00000000-0000-0000-0000-000000000000&quot;</a></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. 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.
    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