简体   繁体   中英

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()

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM