1

how to share .gif image in Facebook from my ios app? i have tried png and jpg format it works . but when i share .gif file. it will just share as normal image not as an animated image.
so if anybody had try it. please help me out to find solutions.

Paras Gandhi
  • 823
  • 1
  • 13
  • 28

3 Answers3

1

Source: Guide to Animated Gifs for Facebook

If you try to upload a GIF to Facebook, a still image of the first frame will appear. However, there are three ways to try and outsmart the system.

  • Make a Youtube video look like a GIF.

  • Use a third party app on Facebook like Animated Picture. For this app, you do not use your own files. There are hundreds sorted out in different categories to choose from.

  • Post a link to the GIF. Yes, the still image will show up, but a description will accompany it. Yes, it may take more time, but
    your friends will be curious as to what it entails.

But, if the GIF you want to upload is not a moving picture, it should work just fine. If you have a GIF image that is a nonmoving image, you should have no problem uploading it to Facebook. According to the Facebook Developers page, GIFs are one of many file types allowed for uploading to the platform. Other supported image file types include JPG, PNG, PSD, TIFF, JP2, IFF, WBMP and XBM images.

PS: This was the first result that I got when I googled about it. You'll find plenty of other sources for doing the same. For example: You Can Finally Put GIFs on Facebook.

Rahil Arora
  • 3,644
  • 3
  • 26
  • 43
1
 if ([[UIApplication sharedApplication] canOpenURL: [NSURL  URLWithString:@"facebook://app"]]){

    NSLog(@"imag %@",_GIFURL);

    self.documentationInteractionController.delegate = self;
    self.documentationInteractionController.UTI = @"com.facebook.photo";
    self.documentationInteractionController = [self setupControllerWithURL:_GIFURL usingDelegate:self];
    [self.documentationInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

}
else {
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"facebook not installed." message:@"Your device has no facebook installed." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
}
Ramani Hitesh
  • 214
  • 3
  • 15
0

Use UIActivityItemProvider and extend - (id)item {} for Facebook:

Just upload the GIF to Giphy, then provide the Giphy URL to UIActivityViewController instead of the file contents, Facebook will recognize it and show the animated GIF

- (id)item
{    
    if ([self.activityType isEqualToString:UIActivityTypePostToFacebook]) {
        // Upload to Giphy
        ...
        return [NSURL URLWithString:giphyURL];
    }
}

full code is in my GitHub, I am actually a iOS newb so some experts please correct me and the code if possible

Richard Fu
  • 616
  • 10
  • 27