NSString *gifPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"volleyball.gif"];
NSData *gifData = [[NSData alloc] initWithContentsOfFile:gifPath];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setData:gifData forPasteboardType:@"com.compuserve.gif"];
[gifData release];我使用上面的代码复制gif到剪贴板,并复制到彩信,然后发送它。这确实会通过彩信发送gif,但接收方无法识别数据。mms中的附件扩展名为空。但是当我使用系统“复制”并像以前一样做的时候,接收器收到彩信并且gif被识别为gif。
那么我应该怎么做才能让gif被识别呢?
谢谢。我的英语不好,希望你能理解。
发布于 2012-03-21 04:22:35
我让它起作用了。尝尝这个。
NSBundle *bundle = [NSBundle mainBundle];
if (bundle)
{
NSString *moviePath = [bundle pathForResource:@"volleyball" ofType:@"gif"];
if (moviePath)
{
// copy to clipboard
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSData *data = [NSData dataWithContentsOfFile:moviePath];
[pasteboard setData:data forPasteboardType:@"com.compuserve.gif"];
}
}https://stackoverflow.com/questions/8611963
复制相似问题