Unique alphanumeric key generator
Am developing an app in iPad. Using the app i am going to record videos and upload it into the server. I would like to generate a unique alphanumeric key to be used as the video name. IS there any way to ge开发者_JAVA技巧nerate alphanumeric key in objective-c?
Use following function to get random name it will give you very long name so specify the name length you required in my case it is 8.
-(NSString*)getRandomAlphanumericString
{
CFUUIDRef uuidObj = CFUUIDCreate(nil);//create a new UUID
NSString *uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj);
CFRelease(uuidObj);
return [uuidString substringToIndex:8]; //specify length here. even you can use full
}
精彩评论