2

I have to integrate a system in which I have to enter the device UUID manually to register the device into my database. And at the time of login if the device UUID match with the database value, only then the user can able to access the application.

Now my problem is that when I am fetching the Device UUID using iTunes it comes different and Programeticaly fetched value is different.

I am using the below code.

UIDevice.current.identifierForVendor!.uuidString 

please let me know what I am doing wrong.

UPDATE:- Please read the complete problem before down vote :(

8
  • any other unique identifier also work for me Commented Dec 12, 2019 at 13:43
  • You could use something like: let unique = NSUUID().uuidString ? check NSUUID class for more. Commented Dec 12, 2019 at 13:46
  • Thanks, @Lucho but my problem is still the same. The UUID gets updated every time but my device UUID from iTunes remains the same. Commented Dec 12, 2019 at 14:04
  • I see, you could store it on the KeyChain or user defaults? Commented Dec 12, 2019 at 14:07
  • @Lucho in my app, I can store it but before installing the app into any device. I have to register that device into my DB Where I am using the UDID from iTunes. Because UDID of a device is never changed. But when I am trying to fetch the same programmatically it's got changed every time. Commented Dec 12, 2019 at 14:13

1 Answer 1

5

identifierForVendor is not the device UUID. You cannot programmatically access the device UUID. The only ID you are supposed to use to identify a device is identifierForVendor, which intentionally can change if the user uninstalls all of your apps. There is, intentionally, no fixed-to-the-device ID that you are permitted to access.

Sign up to request clarification or add additional context in comments.

2 Comments

Mean's I have to change my authentication approach.
Correct. This is not a permitted approach.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.