龙图SDK目前整合了极验图形验证功能。
接入龙图BaseSDK,拷贝SDK内可选项,LTVerificationSDK到xcode工程。
/**
* 启动验证接口
* @param extend 扩展参数
* @param VerificationLinstener 结果回调
*/
void startVerification(const char * scene ,void (* pfunc)(bool result, int errCode,const char *extend));
/**
* 启动验证接口
* @param extend 扩展参数
* @param VerificationLinstener 结果回调
*/
LTGameSDK::GetInstance().startVerification(extinfo , verificationLinstener);
/**
* 验证码业务验证结果回调
*
* @param isSuccess 验证结果
* @param errCode 错误码
* @param extend 扩展参数
*
*/
void verificationLinstener(bool result, int errCode,const char *extend)
errCode 参数说明,LTParam内LTGameVerification 定义。
参数 | 参数描述 | 参数值 |
---|---|---|
GAME_VERIFICATION_SUCCESS | 验证成功 | 0 |
GAME_VERIFICATION_FAIL | 验证失败 | 1 |
GAME_VERIFICATION_CANCEL | 验证取消,用户主动关闭 | 2 |
GAME_VERIFICATION_ERRORE | 验证错误,服务器交互错误 | 3 |
GAME_VERIFICATION_NO_GEETEST | 加载 验证业务的LTVerificationGeetestSDK.framework 失败 | 4 |
/**
* 验证码业务验证结果回调
*
* @param isSuccess 验证结果 true成功 ,false 失败
* @param errCode 错误码
* @param extend 扩展参数, 研发传过来的透传参数
*
*/
void verificationLinstener(bool result, int errCode,const char *extend){
cout<<"*********VerificationLinstener********"<<endl;
if(result == true){
cout<<"VerificationLinstener:验证成功!"<<endl;
LTSDK::GetInstance().ShowMsg("验证成功");
}else{
cout<<"VerificationLinstener:验证失败"<<endl;
switch (errCode) {
case GAME_VERIFICATION_FAIL:
LTSDK::GetInstance().ShowMsg("验证失败");
break;
case GAME_VERIFICATION_CANCEL:
LTSDK::GetInstance().ShowMsg("验证失败 用户取消");
break;
case GAME_VERIFICATION_ERRORE:
LTSDK::GetInstance().ShowMsg("验证失败 和服务器交互错误 ");
break;
case GAME_VERIFICATION_NO_GEETEST:
LTSDK::GetInstance().ShowMsg("加载 验证业务的LTVerificationGeetestSDK.framework 失败");
break;
default:
LTSDK::GetInstance().ShowMsg("验证失败");
break;
}
}
}
/// 打开验证功能
/// @param extinfo 扩展参数
- (void)LTSDKStartVerificationWithExtinfo:(NSString *)extinfo;
/// 打开验证功能
/// @param extinfo 扩展参数
[LTGameOCSDK.shareInstance LTSDKStartVerificationWithExtinfo:@"defaultName"];
/// 验证码业务验证结果回调
/// @param result 是否成功
/// @param errCode 错误码
/// @param extend 扩展信息
- (void)ltVerificationLinstenerWithResult:(BOOL)result errCode:(int)errCode extend:(NSString *)extend;
errCode 参数说明,LTParam内LTGameVerification 定义。
参数 | 参数描述 | 参数值 |
---|---|---|
GAME_VERIFICATION_SUCCESS | 验证成功 | 0 |
GAME_VERIFICATION_FAIL | 验证失败 | 1 |
GAME_VERIFICATION_CANCEL | 验证取消,用户主动关闭 | 2 |
GAME_VERIFICATION_ERRORE | 验证错误,服务器交互错误 | 3 |
GAME_VERIFICATION_NO_GEETEST | 加载 验证业务的LTVerificationGeetestSDK.framework 失败 | 4 |
/// 验证码业务验证结果回调
/// @param result 是否成功
/// @param errCode 错误码
/// @param extend 扩展信息
- (void)ltVerificationLinstenerWithResult:(BOOL)result errCode:(int)errCode extend:(NSString *)extend {
if (result) {
[[LTGameOCSDK shareInstance] LTSDKShowMessage:@"验证成功"];
}
else{
switch (errCode) {
case GAME_VERIFICATION_FAIL:
[[LTGameOCSDK shareInstance] LTSDKShowMessage:@"验证失败"];
break;
case GAME_VERIFICATION_CANCEL:
[[LTGameOCSDK shareInstance] LTSDKShowMessage:@"验证失败 用户取消"];
break;
case GAME_VERIFICATION_ERRORE:
[[LTGameOCSDK shareInstance] LTSDKShowMessage:@"验证失败 和服务器交互错误 "];
break;
case GAME_VERIFICATION_NO_GEETEST:
[[LTGameOCSDK shareInstance] LTSDKShowMessage:@"加载 验证业务的LTVerificationGeetestSDK.framework 失败"];
break;
default:
[[LTGameOCSDK shareInstance] LTSDKShowMessage:@"验证失败"];
break;
}
}
}
上海中清龙图软件有限公司