gpt4 book ai didi

ios - 如何使用 MFMailComposeViewController 发送图像

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:23:26 26 4
gpt4 key购买 nike

我正在尝试使用 MFMailComposeViewController 发送电子邮件,但不知何故无法正常工作。当我不发送图像时,一切正常。但是,如果我尝试添加照片,则会出现以下错误:

-(IBAction)gonder:(id)sender{
MFMailComposeViewController *mailComposeViewController = [[MFMailComposeViewController alloc] init];
mailComposeViewController.mailComposeDelegate = self;

[mailComposeViewController setSubject:@"deneme"];
UIImage *savedImage = self.image;
NSData *imageData = UIImagePNGRepresentation(savedImage);
[mailComposeViewController addAttachmentData:imageData mimeType:@"image/png" fileName:@"photo"];
NSString *emailBody = @"my text";
[mailComposeViewController setMessageBody:emailBody isHTML:NO];

[emailBody release];
NSArray *alicilar=[[NSArray alloc]initWithObjects:@"mymailadress.com", nil];
[mailComposeViewController setToRecipients:alicilar];

[mailComposeViewController view];
}

- (void) mailComposeController:(MFMailComposeViewController*)mailComposeViewController bodyFinishedLoadingWithResult:(NSInteger)result error:(NSError*)error
{
@try
{
id mailComposeController = [mailComposeViewController valueForKeyPath:@"internal.mailComposeController"];
id sendButtonItem = [mailComposeViewController valueForKeyPath:@"internal.mailComposeView.sendButtonItem"];
[mailComposeController performSelector:@selector(send:) withObject:sendButtonItem];
}
@catch (NSException *e) {}
[mailComposeViewController release];
}

这些是错误:
2012-02-14 16:19:58.322 il[653:307] *** 错误:FigCreateCGImageFromJPEG 返回 -12905。输入(空)为 444585 字节。

最佳答案

您尝试附加的图像是否非常大?可能是内存不足的问题。

关于ios - 如何使用 MFMailComposeViewController 发送图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9278728/

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