生成随机验证码

基础类方法:生成随机验证码

codeLength验证码长度

+ (NSString *)randomCode:(int)codeLength
{
    CFUUIDRef uuidObj = CFUUIDCreate(nil);
    NSString *radomString = [(NSString*)CFBridgingRelease(CFUUIDCreateString(nil, uuidObj)) substringToIndex:codeLength];
    CFRelease(uuidObj);

    return radomString;
}

你可能感兴趣的:(生成随机验证码)