CFUUIDRef和CFStringRef-生成唯一标识符

- (NSString *)createCUID:(NSString *)prefix{

    NSString *  result;

    CFUUIDRef   uuid;

    CFStringRef uuidStr;

    uuid = CFUUIDCreate(NULL);   

    uuidStr = CFUUIDCreateString(NULL, uuid);

    result =[NSString stringWithFormat:@"%@-%@", prefix,uuidStr];

    CFRelease(uuidStr);

    CFRelease(uuid);

    return result;

}

 

希望对你有所帮助!

你可能感兴趣的:(String)