//支付url
NSString *aliUrlStr = @"alipays://platformapi/startapp?saId=10000007&qrcode=";
//二维码
NSString *qrStr = @"https://qr.alipay.com/xxx";
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@" , aliUrlStr , qrStr]];
//判断是否安装支付
BOOL success = [[UIApplication sharedApplication] canOpenURL:url];
//跳转到支付宝
BOOL success2 = [[UIApplication sharedApplication] openURL:url];
//跳转到支付宝 - 可判断跳转成功与否
[[UIApplication sharedApplication] openURL:url options:nil completionHandler:^(BOOL success) {
NSLog(@"completionHandler %@" , success ? @"成功" : @"失败");
}];
备注:
运行前需要在plist中添加查询schema:LSApplicationQueriesSchemes
item0:alipays