美文网首页
iOS 接入支付宝人脸认证

iOS 接入支付宝人脸认证

作者: 小鲜肉老腊肉都是肉 | 来源:发表于2022-05-09 09:52 被阅读0次

    1.pod 'AntVerify'需要在podfile第一行添加,pod完毕需要删除,否则找不到其他第三方
    source "https://code.aliyun.com/mpaas-public/podspecs.git"
    2.删除source后pod 'AlipaySDK-iOS'

    3.添加白名单
    <key>LSApplicationQueriesSchemes</key>
    <array>
    <string>alipay</string>
    <string>alipays</string>
    <string>weixinULAPI</string>
    <string>weixin</string>
    </array>
    4.添加相机权限
    5.导入SDK

    import <AlipaySDK/AlipaySDK.h>

    import <AlipayVerifySDK/APVerifyService.h>

    import <ZolozIdentityManager/ZolozSdk.h>

    1. bitcode设置为NO

    7.绑定支付宝(支付宝登录)
    7.1AppDelegate
    -(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{

    [[NSNotificationCenter defaultCenter] postNotificationName:@"FaceVertify" object:@"FaceVertify"];
    
    if ([url.host isEqualToString:@"safepay"]) {
        
        //Callback为nil时,支付代码里的回调才会执行
        //跳转支付宝钱包进行支付,处理支付结果
        [[AlipaySDK defaultService]processOrderWithPaymentResult:url standbyCallback:nil];
        //授权跳转支付宝钱包进行支付,处理支付结果
        [[AlipaySDK defaultService] processAuth_V2Result:url standbyCallback:nil];
    }
    return YES;
    

    }
    7.2SceneDelegate
    -(void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts API_AVAILABLE(ios(13.0)){

    [[NSNotificationCenter defaultCenter] postNotificationName:@"FaceVertify" object:@"FaceVertify"];
    
    if (URLContexts.count > 0) {
        
        NSEnumerator *enumerator = [URLContexts objectEnumerator];
        UIOpenURLContext *urlContext = [enumerator nextObject];
        NSURL *url = urlContext.URL;
        if ([url.host isEqualToString: @"safepay"]) {
            //Callback为nil时,支付代码里的回调才会执行
            //跳转支付宝钱包进行支付,处理支付结果
            [[AlipaySDK defaultService]processOrderWithPaymentResult:url standbyCallback:nil];
            //授权跳转支付宝钱包进行支付,处理支付结果
            [[AlipaySDK defaultService] processAuth_V2Result:url standbyCallback:nil];
        }
    }
    

    }
    7.3绑定支付宝
    [[AlipaySDK defaultService] auth_V2WithInfo:info fromScheme:@"comMXDYQBox" callback:^(NSDictionary *resultDic) {

        //延时一秒钟请求数据,以防止刚进入App时没有网络
    }];
    

    8.支付宝人脸认证
    8.1初始化
    在AppDelegate和SceneDelegate
    [ZolozSdk init];

    相关文章

      网友评论

          本文标题:iOS 接入支付宝人脸认证

          本文链接:https://www.haomeiwen.com/subject/netzyrtx.html