我希望能够在iPhone和iPad上创建GUID/UUID.
目的是能够为所有唯一的分布式数据创建密钥.有没有办法用iOS SDK做到这一点?
有人说UDID (Unique Device IDentifier),有人说UUID (Universally Unique IDentifier).它们是否相同?它们之间有什么区别?
我想以编程方式获取iOS设备的UDID.我使用以下代码来获取iOS设备的UDID.
NSUUID *uuid = [NSUUID UUID];
NSString *uuidString = uuid.UUIDString;
Run Code Online (Sandbox Code Playgroud)
但我得到的输出与我的设备的实际UDID不同.
function b(
a // placeholder
){
return a // if the placeholder was passed, return
? ( // a random number from 0 to 15
a ^ // unless b is 8,
Math.random() // in which case
* 16 // a random number from
>> a/4 // 8 to 11
).toString(16) // in hexadecimal
: ( // or otherwise a concatenated string:
[1e7] + // 10000000 +
-1e3 + // -1000 +
-4e3 + // -4000 +
-8e3 + // …Run Code Online (Sandbox Code Playgroud)