gpt4 book ai didi

ios - 调用 InApp 邮件命令时应用程序崩溃

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

当我通过 UIActionSheet 按钮调用消息撰写表时,出现以下错误。抱歉,这些对我来说意义不大 - 仍在学习:-)

有人能帮忙吗?

这些是出现问题的根源。

list that appears when the app crashes.

Green Bar error

这是在日志中:

2012-06-16 19:10:43.437 Multi Web[2665:4013] XPCProxy received bad message: target did not supply method signature for bodyFinishedDrawing 2012-06-16 19:10:43.489 Multi Web[2665:907] _serviceViewControllerReady:error: Error Domain=XPCObjectsErrorDomain Code=3 "The operation couldn’t be completed. (XPCObjectsErrorDomain error 3.)"

干杯杰夫

        if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;

NSString *subject = [[NSString alloc] initWithFormat:@"Multi Web - Sending %@.txt", _documentFile];

[mailer setSubject:subject];

// Attach an image to the email
NSString *pathFile01 = [NSString stringWithFormat:_documentTXTPath];
NSURL *pdfURLFile01 = [NSURL URLWithString:pathFile01];
NSData *pdfDataFile01 = [NSData dataWithContentsOfURL:pdfURLFile01];
NSString *fileName = [[NSString alloc] initWithFormat:@"%@.txt", _documentFile];
[mailer addAttachmentData:pdfDataFile01 mimeType:@"application/txt" fileName:fileName];

NSString *emailBody =
@"Hi,<br><br>Please find attached the note exported from Multi Web.<br/><br/>Thanks you for using the app.<br/><br/>Kind Regards,<br/>Multi Web Team.";


[mailer setMessageBody:emailBody isHTML:YES];

[self presentModalViewController:mailer animated:YES];
}

// Remove the mail view
[self dismissModalViewControllerAnimated:YES];



- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
switch (result)
{
case MFMailComposeResultCancelled:
NSLog(@"Mail cancelled: you cancelled the operation and no email message was queued.");
break;
case MFMailComposeResultSaved:
NSLog(@"Mail saved: you saved the email message in the drafts folder.");
break;
case MFMailComposeResultSent:
NSLog(@"Mail send: the email message is queued in the outbox. It is ready to send.");
break;
case MFMailComposeResultFailed:
NSLog(@"Mail failed: the email message was not saved or queued, possibly due to an error.");
break;
default:
NSLog(@"Mail not sent.");
break;
}

// Remove the mail view
[self dismissModalViewControllerAnimated:YES];

最佳答案

正确答案是去掉

[self dismissModalViewControllerAnimated:YES] 

就在 presentModalViewController 方法之后。

您正在崩溃,因为您在呈现模态视图 Controller 后不久将其关闭,并尝试在回调委托(delegate)中再次将其关闭(已被释放)。

您可以在我的帖子中阅读有关如何发送应用内电子邮件的信息。

http://blog.mugunthkumar.com/coding/iphone-tutorial-in-app-email/

关于ios - 调用 InApp 邮件命令时应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11061559/

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