Ios9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
2016-08-01 10:50
645 查看
控制台输出
如图是在我启动一个 Xcode 7 + iOS 9 的 App 之后,控制台的输出。
这在 Xcode 6.4 + iOS 8 时,是不会有的情况,原因是【为了强制增强数据访问安全, iOS9 默认会把所有从
下面说解决方案:
①如果你的输出信息是-canOpenURL: failed for URL: "kindle://home" - error: "This app is not allowed to query for scheme kindle"
set Bitcode to NO
去你的 target 里面的 Build Settings 下的 Enable Bitcode,把它设置成 NO,这不一定会阻挡你的控制台继续输出这条信息,但是可以保证你的 App 正常运行。
②如果你的输出信息是 xxxx - error: "This app is not allowed to query for scheme xxxx"
(在这里因为我的 App 集成了分享到QQ、微信、微博的功能,xxxx部分我看到了 mqq、wechat、sinaweibosso 等多条信息)
Info.plist
去 Info.plist 里面建立一个叫 LSApplicationQueriesSchemes 的 Array,把你在xxxx部分看到的词汇一个一个填进去,直至控制台没有任何相关输出即可。
③关于其他通过 WebView 访问 http 网址引发的控制台报错信息
Info.plist 中设置 ATS
如之前所说,Apple 希望我们访问相对安全的 HTTPS,所以在你需要访问 HTTP 时,
虽 Apple 不建议,但可通过在 Info.plist 中声明如上图所示的内容,倒退回不安全的网络请求,这样依然能让 App 访问指定 HTTP,甚至任意的 HTTP。
如图是在我启动一个 Xcode 7 + iOS 9 的 App 之后,控制台的输出。
这在 Xcode 6.4 + iOS 8 时,是不会有的情况,原因是【为了强制增强数据访问安全, iOS9 默认会把所有从
NSURLConnection、
CFURL、
NSURLSession发出的 HTTP 请求,都改为 HTTPS 请求:iOS9.x-SDK编译时,默认会让所有从
NSURLConnection、
CFURL、
NSURLSession发出的 HTTP 请求统一采用 TLS 1.2(SSL 3.1) 协议。】
下面说解决方案:
①如果你的输出信息是-canOpenURL: failed for URL: "kindle://home" - error: "This app is not allowed to query for scheme kindle"
set Bitcode to NO
去你的 target 里面的 Build Settings 下的 Enable Bitcode,把它设置成 NO,这不一定会阻挡你的控制台继续输出这条信息,但是可以保证你的 App 正常运行。
②如果你的输出信息是 xxxx - error: "This app is not allowed to query for scheme xxxx"
(在这里因为我的 App 集成了分享到QQ、微信、微博的功能,xxxx部分我看到了 mqq、wechat、sinaweibosso 等多条信息)
Info.plist
去 Info.plist 里面建立一个叫 LSApplicationQueriesSchemes 的 Array,把你在xxxx部分看到的词汇一个一个填进去,直至控制台没有任何相关输出即可。
③关于其他通过 WebView 访问 http 网址引发的控制台报错信息
Info.plist 中设置 ATS
<code class="xml"><span class="hljs-tag"><<span class="hljs-title">key</span>></span>NSAppTransportSecurity<span class="hljs-tag"></<span class="hljs-title">key</span>></span> <span class="hljs-tag"><<span class="hljs-title">dict</span>></span> <span class="hljs-comment"><!--Include to allow all connections (DANGER)--></span> <span class="hljs-tag"><<span class="hljs-title">key</span>></span>NSAllowsArbitraryLoads<span class="hljs-tag"></<span class="hljs-title">key</span>></span> <span class="hljs-tag"><<span class="hljs-title">true</span>/></span> <span class="hljs-tag"></<span class="hljs-title">dict</span>></span></code>
如之前所说,Apple 希望我们访问相对安全的 HTTPS,所以在你需要访问 HTTP 时,
虽 Apple 不建议,但可通过在 Info.plist 中声明如上图所示的内容,倒退回不安全的网络请求,这样依然能让 App 访问指定 HTTP,甚至任意的 HTTP。
相关文章推荐
- Ios9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- Ios9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- iOS9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- iOS9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"key>
- [iOS]canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- 【iOS开发】-canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- iOS开发-canOpenURL: failed for URL: "mqq://" - error: "This app is not allowed to query for scheme mqq
- -canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- iOS分享授权问题:-canOpenURL: failed ..."This app is not allowed to query for sscheme xx
- 社交分享:-canOpenURL: failed for URL: "weixin://app/*************/" - error: "This app is not allowed to query for scheme weixin"
- iOS 9 failed for URL: "XXX://@" - error: "This app is not allowed to query for scheme XXX" iOS 从APP里
- -canOpenURL: failed for URL: "kindle://home" - error: "This app is not allowed to query for scheme k
- -canOpenURL: failed for URL: "wechat://" - error: "This app is not allowed to query for scheme wech
- -canOpenURL: failed for URL: "weixin://app/wxff569f1617559XX1/" - error: "This app is not allowed to
- iOS 9 failed for URL: "XXX://@" - error: "This app is not allowed to query for scheme XXX" iOS 从APP里启动另一APP
- iOS社会化分享报错:- error: "This app is not allowed to query for scheme mqq"
- iOS应用之间跳转 报错:"This app is not allowed to query for scheme ***"
- 调用app出现"This app is not allowed to query for scheme..."