React-Native FBSDK Share对话框仅适用于模拟器(iOS)
问题描述:
我试图使用ShareDialog
通过React-Native-FBSDK库共享链接。我有我的代码设置像这样:React-Native FBSDK Share对话框仅适用于模拟器(iOS)
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应用程序的设备上,它在打开模型我的应用程序,但它只使用我给它的网址,然后它从网页上的元标记填充所有其他数据,而不是使用我的代码。有什么我需要做的,以使其与原生应用程序一起工作?
iOS的10,反应本地0.30.0,反应母语-fbsdk 0.4.0
答
我有同样的问题。我的解决方案是使用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吗? – Pavan