【问题标题】:Cordova custom URL scheme not work on IOS (unsupported URL)Cordova 自定义 URL 方案在 IOS 上不起作用(不支持的 URL)
【发布时间】:2020-01-08 07:18:32
【问题描述】:

我正在尝试使用指向外部应用程序的深层链接,如下所示:

<Col>
              <a href="https://www.youtube.com/channel/channelname/" className="external"><img src="static/youtube.png" width='35px' alt=""/></a>
              </Col>
              <Col>
              <a href="instagram://user?username=username" className="external"><img src="static/instagram.png" width='31px' alt=""/></a>
              </Col>
              <Col>
              <a href="twitter://user?screen_name=username" className="external"><img src="static/twitter.png" width='35px' alt=""/></a>
              </Col>
              <Col>
              <a href="whatsapp://send?phone=+00000000" className="external"><img src="static/whatsapp.png" width='35px' alt=""/></a>
              </Col>

它在android中工作正常,但我在IOS中出现以下错误

无法加载网页并出现错误:不支持的 URL

我的 config.xml 文件白名单

    <allow-intent href="whatsapp:*" />
    <allow-intent href="instagram:*" />
    <allow-intent href="twitter:*" />

    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <allow-intent href="instagram:*" />    
        <allow-intent href="twitter:*" />
    </platform>

请多多指教..

【问题讨论】:

  • 您好,我遇到了同样的问题,您解决了这个问题吗?请帮帮我。

标签: swift xcode cordova cordova-plugins phonegap


【解决方案1】:

您可以查看this plugin(自定义 URL 方案)

此插件允许您通过使用 mycoolapp://path?foo=bar 之类的 URL 调用应用程序来启动应用程序

【讨论】:

    【解决方案2】:

    您需要指定以下2条规则以允许通过URL打开其他应用程序:

    <access launch-external="yes" origin="whatsapp:*"/>
    <allow-intent href="whatsapp:*"/>
    

    访问规则扮演 CSP 的角色,并控制允许向特定域发出哪些网络请求(图像、XHR 等)(通过 cordova 本地挂钩)。

    Allow Intent 控制允许应用请求系统打开哪些 URL。

    【讨论】:

      猜你喜欢
      • 2021-01-09
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 2012-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-02
      相关资源
      最近更新 更多