标签: swift swift2 swift3 ios10 deviceid
我在swift 2中有以下代码
let deviceid = UIDevice.currentDevice().identifierForVendor!.UUIDString
无法编译。我尝试了xCode中自动修复的建议,我想出了这个。
let deviceid = UIDevice.currentDevice.identifierForVendor!.UUIDString
然而它仍然无法编译。它表示'UUID'类型的值没有成员UUIDString'
答案 0 :(得分:6)
我的建议 - 针对这些问题 - 直接进入游乐场
let deviceid = UIDevice.current.identifierForVendor?.uuidString