3

Когда я распечатываю листок создания сообщений через кнопку UIActionSheet, я получаю следующую ошибку. Извините, что это еще не значит для меня еще - до сих пор учатся :-)ios - приложение вылетает, когда команда почты InApp получает вызов

Не могли бы вы помочь?

Это источники проблем, которые возникают.

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]; 

}

+0

Некоторый код будет нам полезен. – Akshay

+0

Привет, я добавил весь метод, надеюсь, его полезно –

+1

// Удалить почтовый вид [self rejectModalViewControllerAnimated: YES]; Удалите эту строку и повторите попытку, потому что просмотр почты по-прежнему не загружен, поэтому какой модальный вид вы отклоняете – Sumanth

ответ

1

Правильный ответ удалить

[self dismissModalViewControllerAnimated:YES] 

только после того, как метода presentModalViewController.

Вы терпите крах, потому что вы уволите контроллер модального просмотра вскоре после его представления и попробуйте отменить его снова (который уже освобожден) в делегате обратного вызова.

Вы можете прочитать о том, как отправить электронное письмо с приложением в мой пост.

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

Смежные вопросы