【问题标题】:React-Native FBSDK Share Dialog only works in simulator (iOS)React-Native FBSDK Share Dialog 仅适用于模拟器(iOS)
【发布时间】:2016-11-15 16:45:02
【问题描述】:

我正在尝试使用 ShareDialog 通过 React-Native-FBSDK 库共享一个链接。我的代码设置如下:

const shareContent = {
  contentType: 'link',
  contentDescription: 'Stuff here',
  contentTitle: 'Share Title',
  contentUrl: 'https://google.com',
  imageUrl: someUrl
}

ShareDialog.canShow(shareContent).then((canShow) => {
  canShow && ShareDialog.show(shareContent);
}

当它在 Safari WebView 中打开时,此代码在模拟器中有效,但是当我在安装了 Facebook 应用程序的设备上加载它时,它会在我的应用程序上打开一个模型,但它只使用我给它的 url,然后它会填充在页面上元标记的所有其他数据中,而不是使用我的代码。我需要做些什么才能让它与本机应用程序一起使用吗?

.

iOS 10,react-native 0.30.0,react-native-fbsdk 0.4.0

【问题讨论】:

    标签: dialog react-native share facebook-sdk-4.0 fbsdk


    【解决方案1】:

    我也有同样的问题。我的解决方案是使用 ShareButton 而不是 ShareDialog。它在我的 iPhone 10.2 中完美运行。

    import {ShareButton} from "react-native-fbsdk";
    
    
    const shareModel = {
            contentType: 'link',
            contentUrl: this.url,
            contentTitle: this.title,
            contentDescription: this.description,
            imageUrl: this.thumb
        };
    
    <ShareButton shareContent={shareModel}/>
    

    【讨论】:

    • this.thumb 的值是多少?它允许外部 URL 吗?
    猜你喜欢
    • 1970-01-01
    • 2020-04-10
    • 2018-11-15
    • 2013-07-19
    • 2018-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-04
    相关资源
    最近更新 更多