Search code examples
iosswiftanimated-giffacebook-sdk-4.0

Swift iOS Facebook SDK: How to share an animated GIF?


I have a document's directory path of a gif I'd like to post to Facebook, but unfortunately when I use this process, it posts a static image instead of it being animated. I know it's animated because I can save the same image to my camera roll and see that it animates. Is there anyway of posting an animated version of this GIF?

let image = UIImage(contentsOfFile: path) // document directory path

let sharePhoto = FBSDKSharePhoto()
sharePhoto.image = image

let content = FBSDKSharePhotoContent()
content.photos = [sharePhoto]

let shareDialog: FBSDKShareDialog = FBSDKShareDialog()
shareDialog.shareContent = content
shareDialog.mode = .native
shareDialog.show()

Solution

  • This is not as issue with your image due to Facebook natively not support gif image directly uploaded on it.

    You can share gif image link on Facebook and it will show there gif image. Like as commonly peoples are using giphy, tenor website and share gif image link from this website. So gif image display via this type of website.

    I hope this will help you.