2016-09-27 57 views
2

我有迅速2UIDevice.currentDevice()。identifierForVendor!.UUIDString斯威夫特3迁移

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

这无法编译下面的代码。我尝试了xCo​​de中自动修复的建议,并提出了这个建议。

let deviceid = UIDevice.currentDevice.identifierForVendor!.UUIDString 

但是它仍然不能编译。它说的类型“UUID”值没有任何成员UUIDString”

+0

为什么-1?我认为这是一个合理的问题,即使它确实有一个简单的答案。 –

回答

5

我的建议 - 这些类型的问题 - 我们直接进入操场

let deviceid = UIDevice.current.identifierForVendor?.uuidString 

Playground xCode 8

+0

很好用! –