美文网首页
APP跳转支付宝指定界面

APP跳转支付宝指定界面

作者: nongjiazhen | 来源:发表于2018-10-17 12:25 被阅读0次
    NSString *urlString = @"";
    ///跳转支付宝指定界面前面需要拼接 alipays://platformapi/startapp?appId=20000067&url=%@
    NSString *alipayUrl = [NSString stringWithFormat:@"alipays://platformapi/startapp?appId=20000067&url=%@", urlString.URLEncodedString];
    SMLog(@"alipayUrl = %@",alipayUrl);
    ///是否可以打开支付宝,打不开说明未安装
    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"alipays://"]]) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:alipayUrl] options:@{} completionHandler:nil];
    } else {
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"检测到您尚未安装支付宝,是否下载并安装支付宝完成认证?" preferredStyle:UIAlertControllerStyleAlert];
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:0 handler:^(UIAlertAction * _Nonnull action) {
            NSString *appstoreUrl = @"itms-apps://itunes.apple.com/app/id333206289";
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appstoreUrl] options:@{} completionHandler:nil];
        }]];
        [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
        [weakSelf presentViewController:alert animated:YES completion:nil];
    }
/**
 *  URLEncode
 */
- (NSString *)URLEncodedString
{
    
    NSString *unencodedString = self;
    NSString *encodedString = (NSString *)
    
    CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                              (CFStringRef)unencodedString,
                                                              NULL,
                                                              (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                              kCFStringEncodingUTF8));
    /*
     CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,
                                                              (CFStringRef)unencodedString,
                                                              NULL,
                                                              (CFStringRef)@"?!@#$^&%*+,:;='\"`<>()[]{}/\\| ",
                                                              kCFStringEncodingUTF8));
     */
    return encodedString;
}

相关文章

  • APP跳转支付宝指定界面

  • 外部跳转APP

    需求 广告推广、华为微服务;通过外部网页或者卡片跳转到我们的app指定界面。如果app已经存在打开app,app不...

  • 课程三

    1.导航器: 路由进行跳转 界面获取到跳转传递的参数: 界面返回上一页或者跳转到指定的界面

  • iapp跳转界面

    用法:(输入界面文件名,跳转指定的界面) uigo("abc.iyu") //带参数的跳转 uigo("abc.i...

  • iOS-如何跳转至WhatsApp指定联系人对话界面

    最近接了个新需求, 就是需要从公司项目跳转到第三方通讯App的指定联系人的对话界面。大概就是跳转到第三方APP时...

  • IOS 遇到的坑

    IOS 开发值网络权限和跳转系统的指定界面 在开发中APP 首次安装的时候,会弹出一个是否允许APP 访问网络...

  • iOS app跳转 微信,支付宝

    iOS app跳转支付宝NSString *str = @"alipay://支付宝key";[[UIApplic...

  • 判断有无安装某个app,并跳转app或者appStore单页

    需求:某界面推广app下载,如果手机安装了app,直接Scheme跳转跳转app。如果没有安装,modal出app...

  • iOS应用跳转

    应用跳转是指,自己的app跳转到指定的app(如果用户安装了此app的话). 例1:AppA 跳转到AppB. A...

  • 应用间跳转、通信

    应用间跳转 •app应用的跳转的原理 •如何实现两个app应用之间的跳转 •如何实现两个app之间跳转到指定的页面...

网友评论

      本文标题:APP跳转支付宝指定界面

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