开发者

Unique alphanumeric key generator

开发者 https://www.devze.com 2023-04-05 04:30 出处:网络
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

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

精彩评论

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

关注公众号