1

我在我的 RN 应用程序中使用 react-native-fbsdk(版本“react-native-fbsdk”:“^0.10.1”,)我正在使用ShareDialog.show方法并获取回调和检查结果,一切正常但是当我安装 FB应用程序并尝试通过 FB 应用程序分享,然后通过承诺获得空回调结果(我分享或取消帖子)。所以,我尝试了很多方法,结果是一样的。

下面是我的代码

  shareLinkWithShareDialog() {
    var tmp = this;
    // If remove below line the code work with in app dialog
    ShareDialog.setMode('native'); 
    ShareDialog.canShow(this.state.shareLinkContent).then(
      function(canShow) {
        if (canShow) {
          return ShareDialog.show(tmp.state.shareLinkContent);
        }
      }
    ).then(
      function(result) {
        if (result.isCancelled) {
          alert('Share cancelled');
        } else {
          alert('Share success with postId: ' + result.postId);
        }
      },
      function(error) {
        alert('Share fail with error: ' + error);
      }
    );
  }

所以,我的问题是,我怎样才能得到应用程序内对话框的结果(当不使用ShareDialog.setMode('native');line.

更新问题:

现在我收到回调,但总是{isCancelled: true}。我只是更新 AppDelegate 方法并return [RCTLinkingManager application:application openURL:url options:options]使用return [[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:sourceApplication annotation:nil].

4

0 回答 0