0

I wanted to identify every device uniquely. can I use use UDID? How can I identify device uniquely? Other than the UDID of iPhone. I want to identify and authenticate a user's device permanently so that he doesn't need to authenticate again and again from the same device. How can I identify the user's device uniquely?

  • How are you doing authentication then? Why are you not simply generating a sessionKey on your authentication layer? And more relevant, are you using TLS when you are authenticating? – Antwan van Houdt Mar 17 '16 at 11:05

2 Answers2

1

This will always be unique

+(NSString *)getDeviceId
{
    UIDevice *device = [UIDevice currentDevice];
    NSString  *currentDeviceId = [[device identifierForVendor]UUIDString];
    return currentDeviceId;
}
Awesome.Apple
  • 1,316
  • 1
  • 11
  • 24
  • identifierForVendor stays the same unless the user deletes all of your company's apps and then reinstalls one of them. In that case it will change. – Duncan C Mar 17 '16 at 11:07
-1

The better option is to use UDID. Other than UDID you can register for remote notification and get device tocken. Device tocken is also unique.

//UDID in swift

 let currentdeviceid = UIDevice.currentDevice().identifierForVendor?.UUIDString

//device tocken in swift

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
    let characterSet: NSCharacterSet = NSCharacterSet( charactersInString: "<>" )
    let deviceTokenString: String = ( deviceToken.description as NSString )
        .stringByTrimmingCharactersInSet( characterSet )
        .stringByReplacingOccurrencesOfString( " ", withString: "" ) as String
}
user3815344
  • 243
  • 1
  • 21