title: How can i generate and use unique deviceId for iOS devices?
body: <p>In my previous app,I was using the below mentioned code to generate unique deviceId for iOS devices.But the problem is that it will generate a new code everytime when the app is reinstalled.How can i do this properly?</p>
  
  <pre><code>-(NSString*)uniqueIDForDevice //new..
  {
      NSString* uniqueIdentifier = nil;
      if( [UIDevice instancesRespondToSelector:@selector(identifierForVendor)] ) { // &gt;=iOS 7
          uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
      }
      else
      { //&lt;=iOS6, Use UDID of Device
          CFUUIDRef uuid = CFUUIDCreate(NULL);
          //uniqueIdentifier = ( NSString*)CFUUIDCreateString(NULL, uuid);- for non- ARC
          uniqueIdentifier = ( NSString*)CFBridgingRelease(CFUUIDCreateString(NULL, uuid));// for ARC
          CFRelease(uuid);
      }
  
      return uniqueIdentifier;
  }
  </code></pre>