适配ios9出现的问题:-canOpenURL: failed for URL

-canOpenURL: failed for URL: "wtloginmqq2://qzapp" - error: "(null)"

2015-09-13 15:51:10.903[2948:1118021] -canOpenURL: failed for URL: "mqqopensdkapiV3://qzapp" - error: "(null)"

2015-09-13 15:51:10.904[2948:1118021] -canOpenURL: failed for URL: "mqqwpa://qzapp" - error: "(null)"

2015-09-13 15:51:10.905[2948:1118021] -canOpenURL: failed for URL: "mqqopensdkapiV2://qzapp" - error: "This app is not allowed to query for scheme mqqopensdkapiV2"

2015-09-13 15:51:10.906[2948:1118021] -canOpenURL: failed for URL: "mqqOpensdkSSoLogin://qqapp" - error: "This app is not allowed to query for scheme mqqOpensdkSSoLogin"

2015-09-13 15:51:10.906[2948:1118021] -canOpenURL: failed for URL: "mqq://qqapp" - error: "This app is not allowed to query for scheme mqq"

2015-09-13 15:51:10.907[2948:1118021] -canOpenURL: failed for URL: "mqzoneopensdkapiV2://qzapp" - error: "This app is not allowed to query for scheme mqzoneopensdkapiV2"

2015-09-13 15:51:10.908[2948:1118021] -canOpenURL: failed for URL: "mqzoneopensdkapi19://qzapp" - error: "This app is not allowed to query for scheme mqzoneopensdkapi19"

2015-09-13 15:51:10.909[2948:1118021] -canOpenURL: failed for URL: "mqzoneopensdkapi://qzapp" - error: "This app is not allowed to query for scheme mqzoneopensdkapi"

2015-09-13 15:51:10.910[2948:1118021] -canOpenURL: failed for URL: "mqzoneopensdk://qzapp" - error: "This app is not allowed to query for scheme mqzoneopensdk"

2015-09-13 15:51:10.911[2948:1118021] -canOpenURL: failed for URL: "mqzone://qzapp" - error: "This app is not allowed to query for scheme mqzone"

2015-09-13 15:51:10.911[2948:1118021] -canOpenURL: failed for URL: "wtloginmqq2://qzapp" - error: "(null)"

2015-09-13 15:51:10.912[2948:1118021] -canOpenURL: failed for URL: "mqqopensdkapiV3://qzapp" - error: "(null)"

现在app在ios9运行出现了这些,查了下资料。
根据网上的做法。

iOS9 URL Schemes 

除了要在项目info URL Types中设置URL Schemes,还需要在info.plist里面增加可信任的调用app,否则回报如下错误

-canOpenURL: failed for URL: "weixin://app/wx9c8771d3c07dfd30/" - error: "This app is not allowed to query for scheme weixin"

-canOpenURL: failed for URL: "wtloginmqq2://qzapp" - error: "This app is not allowed to query for scheme wtloginmqq2"

info.plist加入

<key>LSApplicationQueriesSchemes</key>

<array>

<string>urlscheme</string>

<string>urlscheme2</string>

<string>urlscheme3</string>

<string>urlscheme4</string>

</array>

我加入之后。

本来加入之前提示:
-canOpenURL: failed for URL: "mqqopensdkapiV2://qzapp" - error: "This app is not allowed to query for scheme mqqopensdkapiV2"

加入之后,error原因就没有了。如下:

-canOpenURL: failed for URL: "mqqopensdkapiV2://qzapp" - error: "(null)"

可是仍然是fail的。不知道如何解决?

回答:

要使用iOS9的真机!不要用模拟器测试,不然一直报-canOpenURL: failed for URL: "XXXXXXXXXX" - error: "(null)"。我真机测试通过了。

回答:

<key>LSApplicationQueriesSchemes</key>

<array>

<string>mqqOpensdkSSoLogin</string>

<string>mqzone</string>

<string>sinaweibo</string>

<string>alipayauth</string>

<string>alipay</string>

<string>safepay</string>

<string>mqq</string>

<string>mqqapi</string>

<string>mqqopensdkapiV3</string>

<string>mqqopensdkapiV2</string>

<string>mqqapiwallet</string>

<string>mqqwpa</string>

<string>mqqbrowser</string>

<string>wtloginmqq2</string>

<string>weixin</string>

<string>wechat</string>

</array>加了15条 才实现

qq登录绑定,qq支付,qq分享
微信支付,微信登录绑定
新浪登录绑定
支付宝支付,支付宝登录绑定

回答:

最好的方法是直接看官方文档

  1. 支持http协议

(1)暂时回退到http协议 info plist加

<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

</dict>

(2)添加指定域名为http白名单

2 涉及到客户端跳转 设置scheme到LSApplicationQueriesSchemes

总结:像此类问题 使用第三方的直接看别人官网就行了 要不访问提供方的如微信,QQ,支付宝API官方看开发文档
如果是用sharesdk 友盟此类的 去看他们的开发文档都会第一时间给开发者提供解决方案的

sharesdk分享 iOS9适配文档地址
http://wiki.mob.com/ios9-对sharesdk的影响(适配ios-9必读)/

友盟分享 iOS9适配地址
http://dev.umeng.com/social/ios/ios9

如果是支付其它登陆一类的 也是一样去它们官方 开发文档看看就OK了

iOS有问必答社区为你回答
426981364
有问题可以扣群上直接问

回答:

解决了,
分享到qq,需要加上图片描述

分享到微信需要加上:图片描述


回答:

找到答案了吗?我加上了也还是报错null

回答:

添加了还是会继续报错吗?那个url scheme的

回答:

添加了 依然会继续报错 那个url scheme的 有谁看看怎么解决的啊

回答:

这个模拟器的一个 bug,如果使用iOS9的真机就可以避免出现该问题,估计 Xcode 后续的升级中会修复掉。

测试 URL Scheme 尽量避免使用模拟器测试,不然一直报

-canOpenURL: failed for URL: "XXXXXXXXXX" - error: "(null)"。

亲测真机通过。

更多 iOS9适配问题请访问--》 《iOS9适配系列教程》

回答:

-canOpenURL: failed for URL: "mqzone://sdk" - error: "(null)" 在真机上,仍然会报这个,已经添加<string>mqzone</string>了。而且重启app就好了,一旦调用TecentOAuth的

(void)logout:(id<TencentSessionDelegate>)delegate;
这个方法,再执行登录授权,就会报刚刚那个错误。

我现在把这句删掉了,退出登录的时候直接清除一下TecentOAuth的accessToken,就没问题了

回答:

如果你的应用使用了如SSO授权登录或跳转分享功能,在iOS9下就需要增加一个可跳转的白名单,指定对应跳转App的URL Scheme,否则将在第三方平台判断是否跳转时用到的canOpenURL时返回NO,进而只进行webview授权或授权/分享失败。


回答:

-canOpenURL: failed for URL: "weixin://app/wxa25a198a4530b133/" - error: "(null)"
scheme 都添加了 而且 是真机
大神 求 指导

回答:

这个解决2个问题就可以了:1首先在info.plist文件里添加

<key>LSApplicationQueriesSchemes</key>

<array>

<string>hui123BBB</string>

<!-- <string>urlscheme2</string>-->

<!-- <string>urlscheme3</string>-->

<!-- <string>urlscheme4</string>-->

</array>

2、然后,urlscheme 填对就可以了:
UIApplication *app = [UIApplication sharedApplication];

NSURL *url = [NSURL URLWithString:@"hui123BBB://"];

[[UIApplication sharedApplication] openURL:url];

if ([app canOpenURL:url]) {

[app openURL:url];

}else{

NSLog(@"打开错误");

}

回答:

我支付宝支持成功后,打印出一排排这样的错误?什么情况呢?没理解
2016-07-19 09:24:20.756 panjing[1039:402641] -canOpenURL: failed for URL: "momochs://" - error: "This app is not allowed to query for scheme momochs"
2016-07-19 09:24:20.758 panjing[1039:402641] -canOpenURL: failed for URL: "tenpay://" - error: "This app is not allowed to query for scheme tenpay"
2016-07-19 09:24:20.759 panjing[1039:402641] -canOpenURL: failed for URL: "com.icbc.iphoneclient://" - error: "This app is not allowed to query for scheme com.icbc.iphoneclient"
2016-07-19 09:24:20.761 panjing[1039:402641] -canOpenURL: failed for URL: "wx2654d9155d70a468://" - error: "This app is not allowed to query for scheme wx2654d9155d70a468"
2016-07-19 09:24:20.766 panjing[1039:402641] -canOpenURL: failed for URL: "meituan0000://" - error: "This app is not allowed to query for scheme meituan0000"
2016-07-19 09:24:20.776 panjing[1039:402641] -canOpenURL: failed for URL: "dianping://" - error: "This app is not allowed to query for scheme dianping"
2016-07-19 09:24:20.784 panjing[1039:402641] -canOpenURL: failed for URL: "diditaxi://" - error: "This app is not allowed to query for scheme diditaxi"
2016-07-19 09:24:20.786 panjing[1039:402641] -canOpenURL: failed for URL: "cn.12306://" - error: "This app is not allowed to query for scheme cn.12306"
2016-07-19 09:24:20.786 panjing[1039:402641] -canOpenURL: failed for URL: "mtxx://" - error: "This app is not allowed to query for scheme mtxx"
2016-07-19 09:24:20.787 panjing[1039:402641] -canOpenURL: failed for URL: "youku://" - error: "This app is not allowed to query for scheme youku"
2016-07-19 09:24:20.787 panjing[1039:402641] -canOpenURL: failed for URL: "baidumap://" - error: "This app is not allowed to query for scheme baidumap"
2016-07-19 09:24:20.788 panjing[1039:402641] -canOpenURL: failed for URL: "iosamap://" - error: "This app is not allowed to query for scheme iosamap"

2016-07-19 09:24:21.101 panjing[1039:402485] retryHandleOpenURL

以上是 适配ios9出现的问题:-canOpenURL: failed for URL 的全部内容, 来源链接: utcz.com/p/184445.html

回到顶部