首页 > 代码库 > 社交分享:-canOpenURL: failed for URL: "weixin://app/*************/" - error: "This app is not allowed to query for scheme weixin"

社交分享:-canOpenURL: failed for URL: "weixin://app/*************/" - error: "This app is not allowed to query for scheme weixin"

升级到iOS9后,微信,QQ,微博等社交软件的分享都失效了,控制台默默地打印了这条信息:

This app is not allowed to query for scheme xxx

 

这是因为iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装。

受此影响,当你的应用在iOS 9中需要使用微信SDK的相关能力(分享、收藏、支付、登录等)时,需要在“Info.plist”里配置:

<key>LSApplicationQueriesSchemes</key><array>    <string>douyutv</string>    <string>mqqapi</string>    <string>mqq</string>    <string>mqqOpensdkSSoLogin</string>    <string>mqqconnect</string>    <string>mqqopensdkdataline</string>    <string>mqqopensdkgrouptribeshare</string>    <string>mqqopensdkfriend</string>    <string>mqqopensdkapi</string>    <string>mqqopensdkapiV2</string>    <string>mqqopensdkapiV3</string>    <string>mqzoneopensdk</string>    <string>wtloginmqq</string>    <string>wtloginmqq2</string>    <string>mqqwpa</string>    <string>mqzone</string>    <string>mqzonev2</string>    <string>mqzoneshare</string>    <string>wtloginqzone</string>    <string>mqzonewx</string>    <string>mqzoneopensdkapiV2</string>    <string>mqzoneopensdkapi19</string>    <string>mqzoneopensdkapi</string>    <string>mqqbrowser</string>    <string>mttbrowser</string>    <string>sinaweibohd</string>    <string>sinaweibo</string>    <string>sinaweibosso</string>    <string>weibosdk</string>    <string>weibosdk2.5</string>    <string>weixin</string>    <string>wechat</string></array>

 

社交分享:-canOpenURL: failed for URL: "weixin://app/*************/" - error: "This app is not allowed to query for scheme weixin"