search

Home  >  Q&A  >  body text

适配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的。不知道如何解决?

巴扎黑巴扎黑2772 days ago1034

reply all(13)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 16:43:05

    You need to use a real device with iOS9! Do not use the simulator to test, otherwise it will keep reporting -canOpenURL: failed for URL: "XXXXXXXXXX" - error: "(null)". My real machine test passed.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:43:05

    <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 login binding, qq payment, qq sharing
    WeChat payment, WeChat login binding
    Sina login binding
    Alipay payment, Alipay login binding

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:43:05

    The best way is to read the official documentation directly

    1. Support http protocol

    (1) Temporarily fall back to http protocol info plist added

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

    (2) Add the specified domain name to the http whitelist

    2 Involves client jump setting scheme to LSApplicationQueriesSchemes

    Summary: For problems like this, if you use a third party, just look at other people’s official websites. Otherwise, visit the providers’ official APIs such as WeChat, QQ, and Alipay to read the development documents.
    If you use sharesdk, Umeng, etc., go to their development documents. We will provide solutions to developers as soon as possible

    sharesdk shares the iOS9 adaptation document address
    http://wiki.mob.com/ios9-%E5%AF%B9sharesdk%E7%9A%84%E5%BD%B1%E5%93%8D%EF%BC% 88%E9%80%82%E9%85%8Dios-9%E5%BF%85%E8%AF%BB%EF%BC%89/

    Umeng shares iOS9 adaptation address
    http://dev.umeng.com/social/ios/ios9

    If you are paying for other logins, you can also go to their official development documents and have a look

    The iOS FAQ community will answer your questions
    426981364
    If you have any questions, you can ask directly in the group

    reply
    0
  • 迷茫

    迷茫2017-04-17 16:43:05

    Solved,
    share to qq, you need to add

    To share on WeChat, you need to add:


    reply
    0
  • 迷茫

    迷茫2017-04-17 16:43:05

    Have you found the answer? I added it but still got an error of null

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:43:05

    Will the error continue to occur even after adding it? That url scheme

    reply
    0
  • 迷茫

    迷茫2017-04-17 16:43:05

    I added it, but it still keeps reporting errors about that url scheme. Does anyone know how to solve it?

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 16:43:05

    There is a bug in this simulator. If you use a real device with iOS 9, you can avoid this problem. It is estimated that Xcode will fix it in subsequent upgrades.

    Test URL Scheme. Try to avoid using simulator to test, otherwise it will always report

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

    Personally tested on a real device and passed.

    For more iOS9 adaptation issues, please visit --" "iOS9 Adaptation Series Tutorials"

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:43:05

    -canOpenURL: failed for URL: "mqzone://sdk" - error: "(null)" On the real machine, this will still be reported, and <string>mqzone</string> has been added. And just restart the app, once TecentOAuth is called

    (void)logout:(id<TencentSessionDelegate>)delegate;
    This method will report the error just now if you execute login authorization again.

    I have deleted this sentence now. When logging out, just clear the TecentOAuth accessToken and it will be fine

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:43:05

    If your application uses functions such as SSO authorized login or jump sharing, you need to add a jumpable whitelist under iOS9 and specify the URL Scheme corresponding to the jump App. Otherwise, the third-party platform will determine whether to jump. When using canOpenURL, NO is returned, and then only webview authorization or authorization/sharing fails.


    reply
    0
  • Cancelreply