美文网首页
Swift获取UUID

Swift获取UUID

作者: 小驴拉磨 | 来源:发表于2020-07-06 17:03 被阅读0次
func get_uuid() -> String{
    //不存在则生成一个新的并保存
    let uuid_ref = CFUUIDCreate(nil)
    let uuid_string_ref = CFUUIDCreateString(nil , uuid_ref)
    let uuid = uuid_string_ref! as String
    UserDefaults.standard.set(uuid, forKey: "donkey")
    return uuid
}

相关文章

网友评论

      本文标题:Swift获取UUID

      本文链接:https://www.haomeiwen.com/subject/yekgqktx.html