tivityViewController将GIF分享到Messe

tivityViewController将GIF分享到Messe

本文介绍了iOS使用UIActivityViewController将GIF分享到Messenger的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试使用 UIActivityViewController 与facebook messenger分享不同类型的图片。我在共享图像(.png)时没有遇到任何问题,但是我无法发送gif图像(.gif),它给出错误无法加载内容。

I am trying to share different type of images using UIActivityViewController to facebook messenger. I am facing no problem while sharing the images (.png), but I am not able to send gif images (.gif), it is giving error "Couldn't load content".

我正在将图像转换为数据&然后通过UIActivityViewController在数组中发送数据。

I am converting the image to data & then sending the data in array through UIActivityViewController.

在这里,我正在发送一个包含详细信息和通知的通知。提取gif路径&然后处理它。

Here, I am firing a notification with the details & extracting the gif path & then processing it.

NSDictionary *dictAsset = [notification userInfo];

NSData *imageData = [NSData dataWithContentsOfFile:dictAsset[@"path"]];

NSArray *imageToShare = [NSArray arrayWithObjects: imageData, [dictAsset objectForKey:@"assetName"], nil];

NSArray *arrAsset = imageToShare;

UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:arrAsset applicationActivities:nil];

有没有人遇到同样的问题?或者如果有人有解决方案,请帮助我。

Has anyone faced same issue? or if anyone has a solution then please help me out.

推荐答案

iOS不会将GIF视为图像。您必须将其作为文件共享:

iOS does not consider a GIF an image. You have to instead share it as a file:

NSURL *gifFile = [NSURL fileURLWithPath:@"funnyface.gif"];

NSArray *items = @[gifFile];

[[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];

这篇关于iOS使用UIActivityViewController将GIF分享到Messenger的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 15:10