How to generate UUID in ios

后端 未结 7 784
北海茫月
北海茫月 2020-11-30 20:59

How to get a UUID in objective c, like in Java UUID is used to generate unique random numbers which represents 128 bit value.

7条回答
  •  北海茫月
    2020-11-30 21:31

    + (NSString *)uniqueFileName
    {
        CFUUIDRef theUniqueString = CFUUIDCreate(NULL);
        CFStringRef string = CFUUIDCreateString(NULL, theUniqueString);
        CFRelease(theUniqueString);
        return [(NSString *)string autorelease];
    }
    

提交回复
热议问题