SWIFT : How to Share multiple Photos or Video on Facebook using FBSDKShareKit?

1

I am using FBSDKShareKit to share video and images on facebook.

Here is the code:-

    if self.postObject.videoUrl.count > 0 {

            let content = ShareMediaContent()
            for VideoData in self.postObject.postedMedia {

                let video = ShareVideo.init(data: VideoData)
                content.media.append(video)
            }
            for thumb in self.postObject.postedVideoThumb {
                let photo = SharePhoto(image: thumb, userGenerated: true)
                content.media.append(photo)
            }
            let dialog = ShareDialog(fromViewController: self, content: content, delegate: self)
            print(dialog.canShow)
            dialog.show()

    }

But I am getting print(dialog.canShow) as false.

And the error I am getting in the "didFailWithError" delegate is:-

" Error Domain=com.facebook.sdk.share Code=2 "(null)" UserInfo={com.facebook.sdk:FBSDKErrorArgumentValueKey={length = 1727854, bytes = 0x00000014 66747970 71742020 00000000 ... acdda1ed 0ae116c8 }, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Cannot share video data., com.facebook.sdk:FBSDKErrorArgumentNameKey=data} "

Where am I doing wrong?

ios
swift
facebook
facebook-share
xcode11.3
asked on Stack Overflow Feb 12, 2020 by iOS Developer • edited Mar 3, 2020 by iOS Developer

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0