0

I went through almost all the related SO questions, googled lot, but I can't get help.

There are lot many posts and SO answers which states to use [UIDevice identifierForVendor], but as this Id is not visible to user, I want different way to uniquely identify the device.

Basically I am developing Enterprise app which will not going to App Store(no need to worry about private APIs). I am having server which has all users details including device id(don't know what to use as device id) already entered.

When device launches app, web service will be called and it needs to send device id to authenticate the device.

That's why I need device id which will be visible to user as well as programmer.

Any help is appreciated!!!

Update
'Visible to user' means user can see this unique id before installing app, so as he/she can send this number to admin to register it on server.

If this unique id is registered on server then and then only access will be given to application, otherwise app will not connect to server.

D4ttatraya
  • 3,344
  • 1
  • 28
  • 50

3 Answers3

0

Use

NSString* uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 
NSLog(@"UDID:: %@", uniqueIdentifier);

You've to put a small case to check the app is running on simulator or on device.

Utkarsh Singh
  • 181
  • 1
  • 4
  • **I need device id which will be visible to user as well as programmer** how this `identifierForVendor` can be visible to user? – D4ttatraya Apr 12 '16 at 18:25
0

You can no longer get a unique ID of device. "identifierForVendor" is the best you're going to get. Apple has systematically disabled identifying a specific device.

Though, "identifierForVendor" value also changed after every new installation of application.

for more info visit.

You're also confusing me with this line "visible to user", could you please be more specific about it?

There's also one more way - Using icloud kit you can get a unique token of currently logged In icloud user account. This is unique per application on device.

It seems you want to track user using unique ID or UDID and Apple doesn't like this so before moving forward please visit.

Update:

If Apple is preventing tracking users using Unique Id, you shouldn't be using it then.

You simply want to validate user on your server. The best solution for you is iCloud token,

Fetch it and store it in User defaults or Keychain and use anywhere you want.

In this way you can also track single user on different devices if he/she is using multiple devices with same iCloud account.

Utkarsh Singh
  • 181
  • 1
  • 4
0

You can try obtain UDID of device via service http://get.udid.io and then authenticate this device on your server.

But after this you will need to obtain the same UDID in your apps to pass it to server... It is possible to pass UDID to app via specific URL schema.

What do you think about this idea? I can share more details if you like it.

Vanger
  • 692
  • 4
  • 10
  • I went through the link, but as it says it uses MDM, all the data like IMEI, serial no and UUID are going to their server, which I don't want. – D4ttatraya Apr 13 '16 at 10:56
  • Then you can make you own solution for obtaining UDID the same way as http://get.udid.io do. What do you think about this idea? – Vanger Apr 13 '16 at 11:46
  • Right now I have only this way to make it happen, let's wait for some more time for more suggestions... – D4ttatraya Apr 13 '16 at 12:22
  • Ok, sounds reasonable. I know how udid.io works inside. We discuss details if you would like. – Vanger Apr 13 '16 at 12:30