Unique identifier for an iPhone app

后端 未结 13 1179
南笙
南笙 2020-11-29 18:33

For an iPhone app that submits images to a server I need somehow to tie all the images from a particular phone together. With every submit I\'d like to send some unique pho

相关标签:
13条回答
  • 2020-11-29 19:16

    I had success with such code:

    - (NSString *)stringUniqueID {
        NSString *  result;
        CFUUIDRef   uuid;
        CFStringRef uuidStr;
        uuid = CFUUIDCreate(NULL);
        assert(uuid != NULL);
        uuidStr = CFUUIDCreateString(NULL, uuid);
        assert(uuidStr != NULL);
        result = [NSString stringWithFormat:@"%@", uuidStr];
        assert(result != nil);
        NSLog(@"UNIQUE ID %@", result);
        CFRelease(uuidStr);
        CFRelease(uuid);
        return result;
    }    
    
    0 讨论(0)
提交回复
热议问题