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
  • 12,762
  • 3
  • 58
  • 74
Joseph Astrahan
  • 8,659
  • 12
  • 83
  • 154

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,840
  • 3
  • 51
  • 62