facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.
https://developers.facebook.com/docs/ios
Other
7.8k stars 3.56k forks source link

Cannot share video asset to Facebook Story #2489

Open vfa-nhanbt opened 1 month ago

vfa-nhanbt commented 1 month ago

Checklist before submitting a bug report

Xcode version

15.4

Facebook iOS SDK version

17.3.0

Dependency Manager

CocoaPods

SDK Framework

Share

Goals

Check the root cause of this error.

Expected results

I want the video to be fully shared from the app to Facebook Story.

Actual results

Steps to reproduce

No response

Code samples & details

if #available(iOS 10.0, *) {
            let pasteboardOptions: [UIPasteboard.OptionsKey: Any] =  [:]
            let backgroundVideo = try? Data(contentsOf: URL(fileURLWithPath: videoFile))
            var pasteboardItems = [String: Any]()
            if let videoBackgroundShare = backgroundVideo {
                pasteboardItems["com.facebook.sharedSticker.backgroundVideo"] = videoBackgroundShare
                pasteboardItems["com.facebook.sharedSticker.appID"] = "<my-facebook-app-id>"
            }
            UIPasteboard.general.setItems([pasteboardItems], options: pasteboardOptions)

            let urlString = "\(stories)://share?source_application=<my-facebook-app-id>"
            let urlScheme = URL(string: urlString)
            UIApplication.shared.open(urlScheme!, options: [:]) { success in
                if success {
                    print("[DEBUGGING] sharing success")
                } else {
                    print("[DEBUGGING] sharing failure")
                }
            }
        }