0

Hey I am developing a watch application and I want to get the device id of the device. But when I try to access using "UIDevice.current" it gives an error that UIDevice is not within scope. Am I doing something wrong or is it somehow restricted for obtaining those information? How can I obtain that information? Thanks in advance

enter image description here

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220
SVG
  • 809
  • 6
  • 21
  • Apple doesn't want you getting a unique fixed id for a device because it's an invasion of the user's privacy to track them with such an id. What are you trying to do? Perhaps there is another way to do what you want to do (assuming it's not privacy invading tracking). – Dad Aug 27 '21 at 15:11
  • See https://developer.apple.com/news/?id=8rm6injj for reference. – Dad Aug 27 '21 at 15:15

1 Answers1

0

For anyone who is also stucked with the above scenario,You can easily achieve the device id by

let deviceId = WKInterfaceDevice.current().identifierForVendor?.uuidString ?? ""
SVG
  • 809
  • 6
  • 21