2012-10-05 4 views
1

XCode를 4.5로 업데이트 했으므로 버튼을 눌러 전자 메일을 보내면 전자 메일 기능이 충돌합니다.IOS 6 Xcode 4.5 MFMailComposer 충돌

내가 뭘 잘못하고 있니?

나는 여기

#import <UIKit/UIKit.h> 
#import <MessageUI/MessageUI.h> 

@interface ImpressumViewController : UIViewController <MFMailComposeViewControllerDelegate> 

버튼에 대한 내 코드 내 헤더 파일에 MessageUI.framework을 구현 한 :

- (IBAction)kontakt:(id)sender { 

    MFMailComposeViewController *mailcontroller = [[MFMailComposeViewController alloc] init]; 
    [mailcontroller setMailComposeDelegate:self]; 
    NSString *email [email protected]"[email protected]"; 
    NSArray *emailArray = [[NSArray alloc] initWithObjects:email, nil]; 
    [mailcontroller setToRecipients:emailArray]; 
    [mailcontroller setSubject:@"Youtube Tutorials"]; 
    [self presentViewController:mailcontroller animated:YES completion:nil]; } 

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{ 
    [self dismissViewControllerAnimated:YES completion:nil]; 



    } 
+0

확실하지는 않지만 [self presentModalViewController : composer animated : 예 완료 : nil]; ("모달"추가) – Romo

+0

안녕하세요, 답변 해 주셔서 감사합니다. 그러나 이것은 작동하지 않습니다. 나는 Modal이 오래된 버전이라고 생각한다. – user1355961

+0

정확히 같은 코드가 나를 위해 일한다. –

답변

0

당신이 대리자 메서드에서 다음 코드를 작성할 필요가

- (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 the next time the user connects to email"); 
      break; 
     case MFMailComposeResultFailed: 
      NSLog(@"Mail failed: the email message was nog saved or queued, possibly due to an error"); 
      break; 
     default: 
      NSLog(@"Mail not sent"); 
      break; 
    } 

    //[self dismissModalViewControllerAnimated:YES]; 
} 
관련 문제