Re: NSSharingService with Animated GIFs?
Re: NSSharingService with Animated GIFs?
- Subject: Re: NSSharingService with Animated GIFs?
- From: Charles Carver <email@hidden>
- Date: Fri, 16 May 2014 11:26:26 -0400
I’ve been doing some more testing and I attempted to save the file to the hard drive first (instead of pulling the data from a URL) and then load it into NSImage. The results are the same, however, as it just attaches the image as a PNG instead of a GIF.
I’m really stumped here...
Charles Carver
> 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