0

I have a project which create a GIF file.

I want to know how could i share/distribute this file with activityView.

Example: Save in library , share to facebook, twitter, messages or e-mail?

I already tried with this project but it's just send a image.

Can somebody help me, maybe give me another project which can share this file and some instructions for use will be much appreciated.

Thank you in advance!

        NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
        NSURL *fileURL = [documentsDirectoryURL URLByAppendingPathComponent:@"animated.gif"];




        NSString *text = @"Text";
        NSData *gifFile=[NSData dataWithContentsOfFile:fileURL.path];
        UIActivityViewController *controller =
        [[UIActivityViewController alloc]
         initWithActivityItems:@[text,gifFile]
         applicationActivities:nil];


        controller.excludedActivityTypes = @[UIActivityTypePostToWeibo,
                                             UIActivityTypePrint,
                                             UIActivityTypeCopyToPasteboard,
                                             UIActivityTypeAssignToContact,
                                             UIActivityTypeAddToReadingList,
                                             UIActivityTypePostToFlickr,
                                             UIActivityTypePostToVimeo,
                                             UIActivityTypePostToTencentWeibo,
                                             UIActivityTypeAirDrop,
                                             UIActivityTypeAssignToContact];
        [self presentViewController:controller animated:YES completion:nil];
Vvk
  • 4,031
  • 29
  • 51
Gaby Fitcal
  • 1,814
  • 1
  • 17
  • 28

1 Answers1

0

You're likely to find that it works via Messages, but not via other UIActivity types such as Twitter.

I took this to mean that I was attaching the GIF correctly, but for example, the Twitter UIActivity was not accepting GIFs (and was instead just posting a still from the GIF).

I created SBBAnimatedTweetActivity to get around this limitation - it's available on GitHub - feel free to use it as a Cocoapod, or fork it for yourself. https://github.com/siburb/SBBAnimatedTweetActivity

siburb
  • 4,880
  • 1
  • 25
  • 34