How to create a GUID/UUID using the iPhone SDK(如何获取一个设备的UUID)

Swift获取方法:


// 获取账户UUID的方法
        let uuid: String = NSUUID().UUIDString
        print("uuid: \(uuid)")```

OC:

  • (NSString *)GetUUID{ CFUUIDRef theUUID = CFUUIDCreate(NULL); CFStringRef string = CFUUIDCreateString(NULL, theUUID); CFRelease(theUUID);
    return (__bridge NSString *)string;}```

In iOS 6 you can easily use:

NSUUID *UUID = [NSUUID UUID];
NSString* stringUUID = [UUID UUIDString];```

你可能感兴趣的:(How to create a GUID/UUID using the iPhone SDK(如何获取一个设备的UUID))