【问题标题】:React Native Linking.canOpenURL() with WhatsApp call使用 WhatsApp 调用响应 Native Linking.canOpenURL()
【发布时间】:2018-03-10 15:45:19
【问题描述】:

我正在尝试创建一个链接,以便从我的 react 本机应用程序开始在 whatsapp 上进行对话,但是 Linking.canOpenURL() 方法总是重新调整错误...

我的代码如下:

const url = `whatsapp://send?phone=${celNumber}`;
Linking.canOpenURL(url).then(supported => {
    if (supported) {
        Linking.openURL(url);
    } else {
        Alert.alert(
            'Alert',
            'WhatsApp is not installed',
        )
    }
});

如果我尝试输入一些其他 url,例如 tel:${celNumber},它会返回 true,所以我认为 whatsapp url 和 canOpenURL() 存在一些问题,因为 whatsapp url 适用于 Linking.openURL() 方法...

【问题讨论】:

    标签: javascript react-native deep-linking whatsapp


    【解决方案1】:

    我问你使用的是 iOS 吗? 然后,您必须在 Info.plist 文件 LSApplicationQueriesSchemes 中声明 URL 的方案“whatsapp”。

    iOS9: canOpenURL returning false for WhatApp's url scheme

    https://developer.apple.com/documentation/uikit/uiapplication/1622952-canopenurl

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-18
      • 2019-09-16
      • 2022-01-10
      • 1970-01-01
      • 2021-03-24
      相关资源
      最近更新 更多