0

I try to upload video to Facebook using Graph API. But always see error message

(#100) No permission to publish the video.

Facebook app has Development mode. I created test user there. My role is admin. FB access token is valid.

Here my code here:

private func upload(url: URL) {
        guard let data = try? Data(contentsOf: url) else { return }
        let connection = GraphRequestConnection()
        connection.delegate = self
        var items: [String: Any] = [:]
        items["title"] = "Test title from api"
        items["\(url.absoluteString)"] = data
        let keys = ["value" : "EVERYONE"]
        items["privacy"] = keys
        
        let request = GraphRequest(graphPath:  "me/videos", parameters: items, httpMethod: .post)
        
        connection.add(request) { reqconnection, anyInfo, error in
            print(reqconnection)
            print(anyInfo)
            print(error)
        }
        
        connection.start()
    }

I saw a lot of questions about it, but mostly they are too old and don't work for me.

  1. Share video to FB
  2. From thread FB Developers here - the same error, but they didn't find solution
  3. Also check this docs - doesn't work

Also I'm a bit confused what docs are right for post video in Facebook. Because in docs I see

The Video API allows you to publish Videos on Pages and Groups. Publishing on Users is not supported.

but also in another docs see Graph API with path me/videos. So it confused me a bit.

What docs are correct for my case:

  1. here
  2. here

From docs I see that

Your app should manage permissions as follows: Graph API Requests - Before you send Graph API requests, you should check for necessary permissions and request them if needed.

Where can I find permission publish_actions?

Please help to figure out how to fix that.

I only can upload via ShareDialog. Like here and docs here

Taras
  • 1,485
  • 1
  • 16
  • 31
  • The Facebook docs you link to specifically say: "This document refers to a feature that was removed after Graph API v3.2.". – WizKid Mar 11 '22 at 22:16
  • @WizKid ok, and what about other docs? I mean about this https://developers.facebook.com/docs/video-api/guides/publishing ? – Taras Mar 12 '22 at 09:11
  • 2
    What about it, it says right there on top of that page, _"The Video API allows you to publish Videos on Pages and Groups. Publishing on Users is not supported."_ – CBroe Mar 14 '22 at 07:18
  • @CBroe thanks, but via `ShareDialog` I can share video on User. So upload via Graph API and ShareDialog is different. Am I right? – Taras Mar 14 '22 at 20:53
  • Yes, the dialogs give the user full control, and are pretty much the last way left to get anything posted onto a user profile. – CBroe Mar 15 '22 at 07:12
  • @CBroe I got it, thanks – Taras Mar 15 '22 at 10:24

0 Answers0