-4

In swift, app we want unique device id.but will not get the unique UUID if i reinstall the same app.

Here's how we get UUID:

if let uuid = UIDevice.current.identifierForVendor?.uuidString { print(uuid) }
  • What have you tried so far? We cannot help you if you don't provide code or a clear question. – miike3459 Jul 04 '19 at 17:52
  • if let uuid = UIDevice.current.identifierForVendor?.uuidString { print(uuid) } – Shantaram Kokate Jul 04 '19 at 17:57
  • I want unique device id but it will return different if i reinstall the app – Shantaram Kokate Jul 04 '19 at 17:58
  • Edit your question to include your program - don't leave it as a comment. See *[How do I ask a good question?](https://stackoverflow.com/help/how-to-ask)* and *[Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)*. – miike3459 Jul 04 '19 at 17:59
  • 1
    *"I want unique device id but it will return different if i reinstall the app"* - It's supposed to change. From the documentation for `identifierForVendor`: *"The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution."* – rmaddy Jul 04 '19 at 18:03
  • @connectyourcharger i think technical person can understand what I want say – Shantaram Kokate Jul 04 '19 at 18:18
  • @ShantaramKokate They may be able to *understand* you, but they are probably not willing to donate their time and effort if you are not willing to donate yours. – miike3459 Jul 04 '19 at 18:45

1 Answers1

1

Read the docs carefully

https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor

There are multiple conditions where the identifierForVendor will not be cycled to a new unique value on a given device.

It’s fairly likely you still have an app from your company with a matching bundle ID. That will prevent the vendorID from being refreshed.

Warren Burton
  • 17,451
  • 3
  • 53
  • 73