【问题标题】:type error null is not an object (evaluating 'ShareDialog.canShow') in React Native FBSDK类型错误 null 不是 React Native FBSDK 中的对象(评估“ShareDialog.canShow”)
【发布时间】:2020-02-15 13:49:15
【问题描述】:

我已按照此 GitHub URL 将 Facebook 共享集成到我的应用程序中。 https://github.com/facebook/react-native-fbsdk 这是我的代码:

constructor(props){
        super(props);
        this.state={
            shareLinkContent : {
                contentType: 'link',
                contentDescription: 'Facebook sharing is easy!',
                contentUrl: 'https://cabbazar.com',
            },
    }
shareLinkWithShareDialog() {
    var tmp = this;
    ShareDialog.canShow(tmp.state.shareLinkContent).then(
      function(canShow) {
        if (canShow) {
          return ShareDialog.show(tmp.state.shareLinkContent);
        }
      }
    ).then(
      function(result) {
        console.log('handle result: ' + result);
      },
      function(error) {
        console.log('Share fail with error: ' + error);
      }
    );
  }

但我的模拟器总是出错。我需要为 Xcode 设置什么吗? 我检查了这个网址,但它没有解决我的问题。 null is not an object (evaluating 'ShareDialog.canShow')

请建议。

谢谢

【问题讨论】:

    标签: ios xcode react-native react-native-fbsdk


    【解决方案1】:

    有时自动链接不起作用。所以你必须使用react-native link react-native-fbsdk手动链接

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-26
      • 2021-06-22
      • 1970-01-01
      • 1970-01-01
      • 2021-08-30
      • 2017-09-19
      相关资源
      最近更新 更多