- (NSString *)uuid{ // Create universally unique identifier (object) CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault); // Get the string representation of CFUUID object. NSString *uuidStr = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, uuidObject)); // If needed, here is how to get a representation in bytes, returned as a structure // typedef struct { // UInt8 byte0; // UInt8 byte1; // ... // UInt8 byte15; // } CFUUIDBytes; // CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuidObject); CFRelease(uuidObject); return uuidStr; }
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // testMethod(); [self testUUID]; NSLog(@"%@", [self uuid]); for (int i = 0; i < 100; i++) { } }
- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
- (NSString *)uuid{ // Create universally unique identifier (object) CFUUIDRef uuidObject = CFUUIDCreate(kCFAllocatorDefault); // Get the string representation of CFUUID object. NSString *uuidStr = (NSString *)CFBridgingRelease(CFUUIDCreateString(kCFAllocatorDefault, uuidObject)); // If needed, here is how to get a representation in bytes, returned as a structure // typedef struct { // UInt8 byte0; // UInt8 byte1; // ... // UInt8 byte15; // } CFUUIDBytes; // CFUUIDBytes bytes = CFUUIDGetUUIDBytes(uuidObject); CFRelease(uuidObject); return uuidStr; }