【问题标题】:UIDevice.currentDevice().identifierForVendor!.UUIDString Swift 3 migrationUIDevice.currentDevice().identifierForVendor!.UUIDString Swift 3 迁移
【发布时间】:2017-02-04 19:26:58
【问题描述】:

我在 swift 2 中有以下代码

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

编译失败。我尝试遵循 xCode 中自动修复的建议,我想出了这个。

 let deviceid = UIDevice.currentDevice.identifierForVendor!.UUIDString

但它仍然无法编译。它说'UUID'类型的值没有成员UUIDString'

【问题讨论】:

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

标签: swift swift2 swift3 ios10 deviceid


【解决方案1】:

我的建议 - 对于这类问题 - 直接进入操场

let deviceid = UIDevice.current.identifierForVendor?.uuidString

【讨论】:

    猜你喜欢
    • 2014-05-16
    • 2017-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多