Facebook共享对话框响应返回帖子ID为零的

时间:2018-07-23 14:58:55

标签: ios swift facebook-ios-sdk fbsdksharedialog

我正在尝试为我的应用程序启动并运行Facebook SDK,但是,我遇到了一个问题。我已经成功使用Facebook功能登录,以及使用FacebookCore,FacebookShare和FacebookLogin可可库发布功能。但是,每当我与完成处理程序共享帖子时,当我打印帖子ID时,它都将返回nil。这是我的帖子代码:

let image = testImage
    let photo = Photo(image: image, userGenerated: true)
    let sharePhotoContent = PhotoShareContent(photos: [photo])
    let dialog = ShareDialog(content: sharePhotoContent)

    dialog.mode = .native
    dialog.failsOnInvalidData = true

    dialog.completion = {

        (result) in

        print(result)

        switch(result) {
        case .success(let contentResponse):
            print("Success the post went through")
            print(contentResponse.postId)
        case .cancelled:
            print("Cancelled by user")
        case .failed(let error):
            print(error.localizedDescription)
        }

    }
    dialog.presentingViewController = self
    do {
        try dialog.show()
    } catch {
        print(error.localizedDescription)
    }

任何帮助将不胜感激。谢谢!

0 个答案:

没有答案