首页 > 解决方案 > Firebase 创建动态链接在本机 iOS 中不起作用。但是它似乎在android中工作正常

问题描述

我使用以下方法创建了一个动态链接:

var link = new firebase.links.DynamicLink(
      "https://freshc.in",
      "frendy.page.link",
    ).android
      .setPackageName("in.frendy.app")
      .ios.setBundleId("in.freshchat.app");
    console.log('link', link); //This is giving the console in both android and ios

    firebase
      .links()
      .createDynamicLink(link)
      .then(url => {
        console.log('Dynamic Link', url); //This is not working in iOS.
        link = "http://" + decodeURIComponent(url);
      });

上面的代码在 android 中运行良好,但是当我们转到 iOS 时,它会抛出一个错误:

可能的未处理承诺拒绝(id:0):错误:无法创建动态链接错误:无法在 createErrorFromErrorData 处创建动态链接(blob:http://localhost:8081/e76b670d-7fe9-40cb-b837-aa0d40d85769:2122:17 ) 在 blob: http://localhost:8081/e76b670d-7fe9-40cb-b837-aa0d40d85769:2074:27 在 MessageQueue.__invokeCallback (blob: http://localhost:8081/e76b670d-7fe9-40cb-b837-aa0d40d85769: 2645:18 ) 在 blob: http://localhost:8081/e76b670d-7fe9-40cb-b837-aa0d40d85769:2376:18 在 MessageQueue.__guard (blob: http://localhost:8081/e76b670d-7fe9-40cb-b837 -aa0d40d85769:2549:13 ) 在 MessageQueue.invokeCallbackAndReturnFlushedQueue (blob:http://localhost:8081/e76b670d-7fe9-40cb-b837-aa0d40d85769:2375:14)在http://localhost:8081/debugger-ui/debuggerWorker.js:80:58

另请注意,当我使用应用程序前缀名称从谷歌搜索时,我可以打开应用程序in.freshachat.app:// 但我没有得到链接

什么可能导致此问题?

标签: iosreact-nativereact-native-firebase

解决方案


好吧好吧,如果有人遇到这个问题,记得在域名中添加“ HTTPS ”:

var link = new firebase.links.DynamicLink(" https://freshc.in ", " https://frendy.page.link ", )


推荐阅读