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 dismissModalViewControllerAnimated : YES]; 이 줄을 제거하고 메일보기가 아직로드되어 있지 않기 때문에 다시 시도하십시오. 어느 모달보기를 닫을까요? – Sumanth

답변

1

정답은 presentModalViewController 메소드 직후에

[self dismissModalViewControllerAnimated:YES] 

을 제거하는 것입니다.

모달보기 컨트롤러가 표시된 직후 모달 뷰 컨트롤러를 닫고 이미 해제 된 콜백 대리자에서 다시 해제하려고하기 때문에 충돌이 발생합니다.

내 응용 프로그램에서 내 응용 프로그램 전자 메일을 보내려면 여기를 읽으십시오.

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

관련 문제