ios UUID

// 返回UUID

- (void)UUID{

    CFUUIDRef uuid_ref = CFUUIDCreate(NULL);

    CFStringRef uuid_string_ref= CFUUIDCreateString(NULL, uuid_ref);

    

    CFRelease(uuid_ref);

    NSString *tmp = [NSString stringWithString:(__bridge NSString*)uuid_string_ref];

    

    CFRelease(uuid_string_ref);

    NSString *uuid = [tmp stringByReplacingOccurrencesOfString:@"-"withString:@""];

    

    [[NSUserDefaultsstandardUserDefaults]setObject:uuid forKey:@"UUID"];

}

猜你喜欢

转载自zhangmingwei.iteye.com/blog/1948217