Facebook FBSDK共享对话框在本机ios模拟器中不工作
我正在尝试添加FBSDK,并尝试使用Xcode模拟器在facebook上实现共享URL。但它总是返回Facebook FBSDK共享对话框在本机ios模拟器中不工作,facebook,react-native,react-native-fbsdk,Facebook,React Native,React Native Fbsdk,我正在尝试添加FBSDK,并尝试使用Xcode模拟器在facebook上实现共享URL。但它总是返回共享操作被取消以下是我的代码 const shareLinkContent = { contentType: 'link', contentUrl: "https://facebook.com", contentDescription: 'Facebook sharing is easy!', }; var tmp = this; ShareDialog.canShow(shareLi
共享操作被取消
以下是我的代码
const shareLinkContent = {
contentType: 'link',
contentUrl: "https://facebook.com",
contentDescription: 'Facebook sharing is easy!',
};
var tmp = this;
ShareDialog.canShow(shareLinkContent).then(
function(canShow) {
console.log(canShow)
if (canShow) {
return ShareDialog.show(shareLinkContent);
}
}
).then(
function(result) {
console.log(result)
if (result.isCancelled) {
alert('Share operation was cancelled');
} else {
alert('Share was successful with postId: '
+ result.postId);
}
},
function(error) {
alert('Share failed with error: ' + error.message);
}
);
}
这是用于共享的HTML按钮
<Button
onPress={() => this.shareLinkWithShareDialog()}
title="share"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
this.shareLinkWithShareDialog()}
title=“股份”
color=“#841584”
accessibilityLabel=“了解有关此紫色按钮的详细信息”
/>
您不能在模拟器上测试它,您需要在真实设备上测试此功能,Facebook应用程序已经安装在真实设备上 如果未安装FB应用程序,我们如何处理这种情况???@DileepaChandima您需要转到应用程序商店并在真实设备上安装Facebook应用程序