gpt4 book ai didi

ios - Facebook ShareDialog 总是在完成时返回 .canceled

转载 作者:可可西里 更新时间:2023-11-01 00:57:19 27 4
gpt4 key购买 nike

共享对话框打开 facebook 应用程序,尽管内容已成功共享,但我总是收到 .cancelled 回调。在这两种情况下 - 当我取消共享时以及共享成功时。知道有什么问题吗?Pod 版本:

Using Bolts (1.8.4)
Using FBSDKCoreKit (4.20.2)
Using FBSDKLoginKit (4.20.2)
Using FBSDKShareKit (4.20.2)
Using FacebookCore (0.2.0)
Using FacebookLogin (0.2.0)
Using FacebookShare (0.2.0)

显示对话框的片段:

    @IBAction func onShareClicked(_ sender: UIButton) {
do{
var myContent = LinkShareContent(url: URL(string: "https://www.facebook.com/8MinuteWorkoutChallenge")!)
myContent.hashtag = Hashtag("#8MWC")

let shareDialog = ShareDialog(content: myContent)
shareDialog.mode = .native
shareDialog.failsOnInvalidData = true
shareDialog.completion = { result in
switch result {
case .success:
print("Share succeeded")
case .failed:
self.shareButton.isHidden = true
case .cancelled:
print("Share cancelled")
}
}

try shareDialog.show()
} catch {
print("Error: \(error)")
}
}

配置

<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb188***33776</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>18851***3776</string>
<key>FacebookDisplayName</key>
<string>8MWC</string>

最佳答案

使用以下代码向当前 View Controller 显示 FB 共享对话框:

{
let shareDialog: FBSDKShareDialog = FBSDKShareDialog()
shareDialog.shareContent = content
shareDialog.delegate = self
shareDialog.fromViewController = self
shareDialog.show()
}

这适用于我分享到 facebook 的链接。您可以使用委托(delegate)方法来获取共享状态回调。

关于ios - Facebook ShareDialog 总是在完成时返回 .canceled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43064013/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com