2016-12-19 5 views
0

내 앱 내부에서 MFMailComposeViewController로 이메일을 보내는 데 문제가 있습니다. 이메일이 전송되었다는 로그 메시지가 표시되지만 내 계정으로 전송되지 않습니다. 나는 네이티브 메일 애플 리케이션에 가서 보낼 편지함에서 보내야합니다. 네이티브 응용 프로그램 내에서도 오류가 발생했음을 알려주는 오류는 없습니다. 사생활 보호 설정 등을 놓치고 있습니까? 이것은 원래 잘 작동했습니다. iOS 10 업데이트 이후에 문제가 있습니다.은 MFMailComposeViewController와 이메일을 보낼 수 없습니다.

-(void)sendEmail:(NSString*)email order:(NSMutableArray *)orderA{ 
MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init]; 
if ([MFMailComposeViewController canSendMail]) 
{ 

    mail.mailComposeDelegate = self; 
    [mail setSubject:[NSString stringWithFormat:@"Order #%@ order", storeNum]]; 
    [mail setMessageBody:[orderA description] isHTML:NO]; 
    [mail setToRecipients:@[email]]; 
    [self presentViewController:mail animated:YES completion:nil]; 
} 
else 
{ 
    NSLog(@"This device cannot send email"); 
} 
} 
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error 
{ 
switch (result) { 
    case MFMailComposeResultSent: 
     NSLog(@"You sent the email."); 
     break; 
    case MFMailComposeResultSaved: 
     NSLog(@"You saved a draft of this email"); 
     break; 
    case MFMailComposeResultCancelled: 
     NSLog(@"You cancelled sending this email."); 
     break; 
    case MFMailComposeResultFailed: 
     NSLog(@"Mail failed: An error occurred when trying to compose this email"); 
     break; 
    default: 
     NSLog(@"An error occurred when trying to compose this email"); 
     break; 
} 

[self dismissViewControllerAnimated:YES completion:nil]; 
} 

답변

0
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error 
{ 
switch (result) { 
    case MFMailComposeResultSent: 
     NSLog(@"You sent the email."); 
     break; 
    case MFMailComposeResultSaved: 
     NSLog(@"You saved a draft of this email"); 
     break; 
    case MFMailComposeResultCancelled: 
     NSLog(@"You cancelled sending this email."); 
     break; 
    case MFMailComposeResultFailed: 
     NSLog(@"Mail failed: An error occurred when trying to compose this email"); 
     break; 
    default: 
     NSLog(@"An error occurred when trying to compose this email"); 
     break; 
} 

[self dismissViewControllerAnimated:YES completion:NULL]; 
} 


-(IBAction)mailClick:(id)sender{ 

if ([MFMailComposeViewController canSendMail]) 
{ 
    MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init]; 
    mail.mailComposeDelegate = self; 
    [mail setSubject:@"Message from XYZ"]; 
    // [mail setMessageBody:@"Here is some main text in the email!" isHTML:NO]; 
    [mail setToRecipients:@[@"[email protected]"]]; 

    [self presentViewController:mail animated:YES completion:NULL]; 
} 
else 
{ 

    NSLog(@"This device cannot send email"); 
} 

} 
+0

당신은 내 코드를 복사 답변으로 제출 했습니까? – iDev