开发者

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 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜