【问题标题】:UIActivityViewController cannot add image to imessageUIActivityViewController 无法将图像添加到 imessage
【发布时间】:2013-03-17 09:09:50
【问题描述】:

我正在使用 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。我不知道为什么? 感谢您的帮助!

【问题讨论】:

  • 文本仅包含操作表。您可以通过邮件和其他选项(例如 twitter Facebook 等)共享图像,但在 iMessage 中它只允许文本。您可以查找可可控件,其中一个可能有服装类,但就行动表而言,没有运气。
  • @Vin:它不工作
  • @crz 我正在使用与您类似的代码,我可以确认该图像现在可以正常发布到 iOS7 中的 iMessage

标签: ios iphone objective-c uiactivityviewcontroller imessage


【解决方案1】:

正如其他人所说,iMessage 仅支持文本,不支持图像。虽然这听起来像在 iOS7 中,但它确实有效。

我个人知道我已经让它与 OvershareKit 一起使用:https://github.com/overshare/overshare-kit

这当然会增加一些开销,但允许您通过其流畅的界面/API 与几乎所有媒体共享。

【讨论】:

  • 在 iTunes 上上传时 Apple 会接受吗?有没有违反苹果规则的代码?
  • 是的。它目前已在我的两个应用程序中被接受和使用。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-16
  • 2014-11-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-01-01
相关资源
最近更新 更多