iOS之自动生成UUID

iOS 自动生成UUID的方法

#pragma mark -- gen_uuid()自动生成UUID
NSString * gen_uuid()
{
    CFUUIDRef uuid_ref = CFUUIDCreate(NULL);
    CFStringRef uuid_string_ref= CFUUIDCreateString(NULL, uuid_ref);
    
    CFRelease(uuid_ref);
    NSString *uuid = [NSString stringWithString:(__bridge NSString*)uuid_string_ref];
    
    CFRelease(uuid_string_ref);
    return uuid;
}

return uuid 就是生成的UUID了。
微笑

你可能感兴趣的:(iOS开发,ios,ios开发,数据,string)