我正在使用UIActivityViewController在ios 6和我的代码上共享图像
UIImage *shareImage = [UIImage imageNamed:@"myImage.png"]; // Init array NSMutableArray *items = [NSMutableArray new]; [items addObject:@""]; [items addObject:shareImage]; // Add image to paste board UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; pasteboard.persistent = YES; pasteboard.image = shareImage; UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:items applicationActivities:nil]; //This is an array of excluded activities to appear on the UIActivityViewController activityVC.excludedActivityTypes = @[UIActivityTypePostToWeibo,UIActivityTypePrint,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeSaveToCameraRoll]; [self presentViewController:activityVC animated:TRUE completion:nil];
一切正常但无法将shareImage粘贴到iMessage.我不知道为什么?
谢谢您帮忙!
解决方法
正如其他人所说,iMessage只支持文本,而不支持图像.虽然听起来像在iOS7中,但确实有效.
我个人知道我已经与OvershareKit合作了:https://github.com/overshare/overshare-kit.
它当然会增加一些开销,但允许您使用光滑的界面/ API与几乎所有介质共享.