zoukankan      html  css  js  c++  java
  • 微信支付回调

    1.在AppDelegate中设置微信代理

    @interface AppDelegate ()<WXApiDelegate>

    2.在openUrl中判断返回url   并设置代理

    - (BOOL)application:(UIApplication *)application

                openURL:(NSURL *)url

      sourceApplication:(NSString *)sourceApplication

            annotation:(id)annotation{

    ([[url scheme] isEqualToString:@"wx711e29e7c52bb3d9"]) {

            if ([url.host isEqualToString:@"pay"]) {

      [WXApi handleOpenURL:url delegate:self];

            }

    }

    3,调用代理方法

    - (void)onResp:(BaseResp *)resp {
        if ([resp isKindOfClass:[PayResp class]]) {
            PayResp *response = (PayResp *)resp;
            if (response.errCode == WXSuccess) {
                  NSLog(@"支付成功");
          
            }else{
               
                NSString *string = @"支付成功";
                [[NSNotificationCenter defaultCenter] postNotificationName:@"wxResult" object:string];
               
                  NSLog(@"支付失败, retcode=%d",resp.errCode);
            }
        }
    }
  • 相关阅读:
    在线思维导图、UML
    SpringBoot定时任务
    SpringBoot邮件发送
    SpringBoot执行异步任务
    banner.txt
    SpringBoot Swagger3.0配置
    SpringBoot durid监控配置
    SpringBoot使用Shiro
    页面LOADING效果
    vue 阻止el-radio事件冒泡
  • 原文地址:https://www.cnblogs.com/gaojingxuan/p/4942793.html
Copyright © 2011-2022 走看看