gpt4 book ai didi

iphone - MFMessageComposeViewController 不显示相机图标

转载 作者:可可西里 更新时间:2023-11-01 03:30:52 26 4
gpt4 key购买 nike

当我手动调出“新消息”时,我会在文本编辑区域的左侧看到一个相机图标。当我使用 MFMessageComposeViewController 时,它不会显示此图标,这意味着您无法插入图像。我知道这是可以做到的,因为制作 txtAgif 的人可以做到。一个细微的区别是 Caps 已打开。这可能是他们如何让它发挥作用的线索。

我知道 MFMessageComposeViewController 不允许您以编程方式插入图像,这就是我执行复制到 UIPasteboard 技巧的原因。这部分工作完美。

有人问过同样的问题herehere除了“无法完成”之外,该问题尚未得到回答。

这是我的第一篇帖子,所以我没有足够高的排名来为其他问题帖子做贡献。

他们是怎么做到的? MFMessageComposeViewController 有技巧还是他们使用了完全不同的东西?

最佳答案

我已经通过以下代码解决了这个问题:

 UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.persistent = YES;
NSString *imagefile =app.strimagepath;

///
BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:imagefile];

if (fileExists)
{
NSData *data = UIImagePNGRepresentation([UIImage imageWithContentsOfFile:imagefile]);
pasteboard.image = [UIImage imageWithData:data];
}
NSString *phoneToCall = @"sms: 123-456-7890";
NSString *phoneToCallEncoded = [phoneToCall stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSURL *url = [[NSURL alloc] initWithString:phoneToCallEncoded];

[[UIApplication sharedApplication] openURL:url];

这里的 app.strimgPath 是图片存放在文档目录的路径。当 MessageView 打开时。长按并单击粘贴,消息将被粘贴。

关于iphone - MFMessageComposeViewController 不显示相机图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9778832/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com