Skip to content

An extended UIActivityItemProvider to share GIF in Twitter and Facebook with UIActivityViewController

License

Notifications You must be signed in to change notification settings

Sweaty-Chair/GifItemProvider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GifItemProvider

An extended UIActivityItemProvider to share GIF in Twitter and Facebook with UIActivityViewController

Twitter: The default UIActivityViewController Twitter share doesn't support it yet which it will "scale down" it as a still JPG. However somehow it works for GIF less than 100kb (tested in iOS 9) and I don't know why. Therefore, I have to use SLRequest to upload the GIF. When the SLRequest is done and return, dismiss the UIActivityViewController The downside of that is no preview share sheet and users cannot type their own message anymore.

Facebook: Upload to Giphy first, and provide the giphy URL to UIActivityViewController instead of the file contents, Facebook with recognize it and show the animated GIF

Usage:

// Init the GifItemProvider

GifItemProvider *gifItem = [[GifItemProvider alloc] initWithPlaceholderItem:@"file://myGIFfilePath"];

// Includess the gifItem in an array

NSArray *items = [NSArray arrayWithObjects: gifItem, @"some string", @"http://some.url", nil];

// Use it in UIActivityViewController

UIActivityViewController *activityController = [[[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil] autorelease];

[UnityGetGLViewController() presentViewController:activityController animated:YES completion:NULL];

P.S. I am a iOS newb and code may be messy and hard coded, will come back for it when I getting better in Objective-C

About

An extended UIActivityItemProvider to share GIF in Twitter and Facebook with UIActivityViewController

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published