NSSharingService with Animated GIFs?
NSSharingService with Animated GIFs?
- Subject: NSSharingService with Animated GIFs?
- From: Charles Carver <email@hidden>
- Date: Wed, 14 May 2014 16:17:46 -0400
I'm pretty new to Objective-C, but have been mostly understanding everything so far. I am stuck, however, on trying to share an animated GIF through NSSharingService.
I am attaching the image like so, where “image" is a string containing the URL of an animated GIF (http://i.imgur.com/V8w9fKt.gif, for example):
NSImage *imageData = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:image]];
NSArray *shareItems = [NSArray arrayWithObjects:imageData, @“Text", nil];
NSSharingService *service = [NSSharingService sharingServiceNamed:NSSharingServiceNameComposeMessage];
service.delegate = self;
[service performWithItems:shareItems];
When the code is run and the message is sent, however, the image gets sent as a PNG file instead of a GIF.
I found a GitHub repo (https://github.com/glebd/ImageSharingTest/) which was attempting to answer a similar problem. A solution was never found, however, but the last bit of advice was:
However, when I add an NSAttributedString with a GIF attachment toNSSharingServicePicker, the shared image is not animated. I can't add the wrapper RTFD data to the picker, as it can only share objects that support NSPasteboardWriting protocol, and the RTFD is returned as NSData.
Copying RTFD data to pasteboard as NSRTFDPboardType works and preserves animation
Would it be possible to convert the GIF to an RTDF object, copy it to the pasteboard, retrieve the pasteboard item, then share that object? Or is there another solution to sharing animated GIFs with NSSharingService?
Charles Carver
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden