3

I have the following code in swift 2

let deviceid = UIDevice.currentDevice().identifierForVendor!.UUIDString

This fails to compile. I tried following suggestions from the auto-fix in xCode and I came up with this.

 let deviceid = UIDevice.currentDevice.identifierForVendor!.UUIDString

However it still does not compile. It says value of type 'UUID' has no member UUIDString'

pedrouan
  • 11,915
  • 2
  • 55
  • 71
Joseph Astrahan
  • 7,050
  • 9
  • 63
  • 126

1 Answers1

7

My advice - for these kind of issues - get straight into a playground

let deviceid = UIDevice.current.identifierForVendor?.uuidString

Playground xCode 8

Damo
  • 12,452
  • 3
  • 46
  • 61