DK
·
更新时间:2020-11-12 17:19:45
setAuthSDKInfo:complete:,初始化SDK秘钥参数。
checkEnvAvailableWithAuthType:complete:,检查当前环境是否⽀持本季 号码检验。
getVerifyTokenWithTimeout:complete:获取本机号码校验 token。
号码速验服务iOS SDK目前主要提供功能:
本机号码校验getVerifyTokenWithTimeout:complete:接⼝(⽀持移动,电信,联通三⼤运营 商)请求本机号码校验的凭证,可⾃定义超时时间,默认3.0s,单位s。
一键登录accelerateLoginPageWithTimeout接口(支持移动,电信,联通三大运营商),是预取号缓存接口,为getLoginTokenWithTimeout接口缓存前置条件,加快授权页的唤起速度。
Targets->General->Linked Frameworks and Libraries 中添加主库ATAuthSDK.framework;
或者Xcode 11中Targets->General->Frameworks,Libraries, and Embedded Content 中添加主库ATAuthSDK.framework。
Targets->BuildSettings设置
Targets->BuildSettings 中 , Other Linker Flags增加-ObjC,一定要添加此选项,注意是大写C,不是小写c,否则工程运行会cras
主项⽬右键添加下ATAuthSDK.framework中ATAuthSDK.bundle资源⽂件,否则⼀键登录授权⻚⾯默认的图⽚或icon显示不出来。
主类TXCommonHandler接口简介
获取认证实例(sharedInstance)
/**
*函数名:sharedInstance
*@param 无
*返回:获取该类的单例实例对象
*/
+(instancetype _Nonnull )sharedInstance;
获取sdk版本号(getVersion)
/**
* 函数名:getVersion
* @param 无
* 返回:字符串,sdk版本号
*/
-(NSString *_Nonnull)getVersion;
设置SDK秘钥(setAuthSDKInfo)
/**
* 函数名:setAuthSDKInfo
* @brief 初始化SDK调用参数,app生命周期内调用一次
* @param 方案对应的秘钥,请登录阿里云控制台后,进入认证方案管理,点击秘钥后复制秘钥,建议维护在业务服务端
* @param complete 结果同步回调,成功时resultDic=@{resultCode:600000, msg:...},其他情况时"resultCode"值请参考PNSReturnCode
*/
- (void)setAuthSDKInfo:(NSString * _Nonnull)info complete:(void(^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
检查认证环境(checkEnvAvailableWithComplete)
/**
* 函数名:checkEnvAvailableWithComplete
* @brief 检查及准备调用环境,resultDic返回PNSCodeSuccess才能调用下面的功能接口,在初次或切换蜂窝网络之后需要重新调用,一般在一次登录认证流程开始前调一次即可
* @param complete 异步结果回调,成功时resultDic=@{resultCode:600000, msg:...},其他情况时"resultCode"值请参考PNSReturnCode,只有成功回调才能保障后续接口调用
*/
- (void)checkEnvAvailableWithComplete:(void (^_Nullable)(NSDictionary * _Nullable resultDic))complete;
/*** 函数名:getReporter* @brief 获取⽇志埋点相关控制对象*/- (PNSReporter * _Nonnull)getReporter;/*** 函数名:accelerateVerifyWithTimeout* @param timeout:接⼝超时时间,单位s,默认3.0s,值为0.0时采⽤默认超时时间* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, token:..., msg:...},其他情况时"resultCode"值请参考PNSReturnCode*/ - (void)accelerateVerifyWithTimeout:(NSTimeInterval)timeout complete:(void (^_Nullable)(NSDictionary* _Nonnull resultDic))complete;/*** 函数名:getVerifyTokenWithTimeout* @param timeout:接⼝超时时间,单位s,默认3.0s,值为0.0时采⽤默认超时时间* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, token:..., msg:...},其他情时"resultCode"值请参考PNSReturnCode*/ - (void)getVerifyTokenWithTimeout:(NSTimeInterval)timeout complete:(void (^_Nullable)(NSDictionary *_Nonnull resultDic))complete;/*** 函数名:setConsolePrintLoggerEnable* @brief 控制台⽇志输出开关,若开启会以PNS_LOGGER为开始标记对⽇志进⾏输出 * @param enable 开关参数,默认为NO*/ - (void)setConsolePrintLoggerEnable:(BOOL)enable;/*** 函数名:setUploadEnable* @brief 设置⽇志及埋点上传开关,但不会对通过 setupUploader: 接⼝实现的⾃定义上传⽅法起作⽤* @param enable 开关设置BOOL值,默认为YES*/- (void)setUploadEnable:(BOOL)enable;/** * 函数名:checkDeviceCellularDataEnable*/+ (BOOL)checkDeviceCellularDataEnable; /** * 函数名:isChinaUnicom*/+ (BOOL)isChinaUnicom; /** * 函数名:isChinaMobile*/+ (BOOL)isChinaMobile; /** * 函数名:isChinaTelecom*/+ (BOOL)isChinaTelecom; /** * 函数名:getCurrentMobileNetworkName * @return ChinaMobile,ChinaUnicom,ChinaTelecom,OtherChinaMobileNetwork,NoChinaMobileNetwork*/+ (NSString *)getCurrentMobileNetworkName; /** * 函数名:getCurrentCarrierName * @return:中国移动,中国联通,中国电信等*/+ (NSString *)getCurrentCarrierName; /** * 函数名:getNetworktype * @return:WiFi,4G,3G,2G,NoInternet等*/+ (NSString *)getNetworktype; /** * 函数名:simSupportedIsOK * @return:*/+ (BOOL)simSupportedIsOK; /** * 函数名:isWWANOpen * @breif:判断wwan是否开启(通过p0网卡判断,无wifi或有wifi情况下都能检测到)*/+ (BOOL)isWWANOpen; /** * 函数名:reachableViaWWAN * @return: */+ (BOOL)reachableViaWWAN; /** * 函数名:getMobilePrivateIPAddress * @return:*/+ (NSString *)getMobilePrivateIPAddress; 当您成功获取到getVerifyTokenWithTimeout成功获取token后,将token与输⼊的⼿机号码传递⾄您 的服务端,服务端携带token调⽤阿⾥云的verifyMobile接⼝即可进⾏最终的校验操作。
iOS问题checkGatewayVerifyEnable一直返回NO?[NSBundle mainBundle].localizedInfoDictionary语句,如果不为nil,则有国际本地化逻辑,这样的情况,目前有两种方法修复:1,如果.strings文件内容为空且无用,删除即可;2,如果.strings文件必须要使用,则需要在主工程中所有.strings文件中增加CFBundleIdentifier = "bundleId名称";
公司名称:上海德诚网联网络技术服务有限公司
客服热线:021-61958165
联系邮箱:wangt@netlink.net.cn
举报邮箱:jubao@netlink.net.cn
地址:上海市闵行区东兰路320号5号楼201室