我有一个用于iOS9的Swift3编写的应用程序,它试图与Facebook共享带有图像和描述的自定义链接。应用程序间切换Plist键配置正确 - 要求用户打开facebook的权限,然后在FB应用程序中创建本机facebook帖子。
问题是点击Post后,用户会返回我的应用,但FB帖子没有完成。我看到一个带有进度指示灯闪烁的小黑屏,但是用户是在完成进度之前返回我的应用程序。 (在应用程序中使用“自动”共享模式时,相同的进度指示器会填满)
如何确保FBSDKShareDialog在返回我的应用之前完成发布指向facebook原生应用的链接?
let content = FBSDKShareLinkContent()
content.contentURL = URL(string: "http://customurl.com/")
content.contentTitle = "Custom Title"
content.contentDescription = "Custom description"
if let imageUrlUnwrapped = imageUrl {
content.imageURL = URL(string: imageUrlUnwrapped)
}
let dialog = FBSDKShareDialog()
dialog.fromViewController = self;
dialog.shareContent = content;
let url = URL(string: "fbauth2://")
if UIApplication.shared.canOpenURL(url!)
{
dialog.mode = FBSDKShareDialogMode.native
}
dialog.show()