swift3 生成UUID

swift3 生成UUID

//获取UUID
func getUUID() -> String {
    let uuidRef = CFUUIDCreate(nil)
    let uuidStringRef = CFUUIDCreateString(nil,uuidRef)
    return uuidStringRef! as String
}

 

结果为如下格式:

F4709DFF-24CD-458F-AECB-C0082B87052A

8A860517-F2FA-4B33-B19E-580749DCAC73

 

 

32位长度uuid。

posted @ 2017-04-24 10:53  那一抹风情  阅读(616)  评论(0编辑  收藏  举报