How to generate UUID in ios
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to get a UUID in objective c, like in Java UUID is used to generate unique random numbers which represents 128 bit value. 回答1: Try: CFUUIDRef udid = CFUUIDCreate(NULL); NSString *udidString = (NSString *) CFUUIDCreateString(NULL, udid); UPDATE: As of iOS 6, there is an easier way to generate UUID . And as usual, there are multiple ways to do it: Create a UUID string: NSString *uuid = [[NSUUID UUID] UUIDString]; Create a UUID: [[NSUUID UUID]; // which is same as.. [[NSUUID] alloc] init]; Creates an object of type NSConcreteUUID and can be