0

我正在尝试为我的应用程序启动并运行 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)
    }

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

4

0 回答 0