2012-11-16 219 views
0

得到一个奇怪的断言失败iOS中呈现电子邮件时提示断言失败

代码:

 
- (void)displayComposerSheet:(id)delegate withDataSource:(id)datasource { 
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; 
    picker.navigationBar.tintColor = self.navigationController.navigationBar.tintColor; 
    picker.mailComposeDelegate = delegate; 
    //Use the datasource to fill in the email fields 
    if ([[datasource recipients] count] > 0) 
     [picker setToRecipients:[datasource recipients]]; 
    [picker setSubject:[datasource subject]]; 

    [picker setMessageBody:[datasource emailText] isHTML:[datasource isHTML]]; 
    [[UIWindow topMostController] presentModalViewController:picker animated:YES]; 
    [picker becomeFirstResponder]; 

    [picker release]; 
} 

 
MyApp[60324:907] *** Assertion failure in -[MFMailComposeInternalViewController _endDelayingCompositionPresentation], /SourceCache/MessageUI/MessageUI-1075.10/Mail/MFMailComposeInternalViewController.m:316 

回答

0

唉混写的危险....

我用我自己的方法调用UINavigationController的pushViewController方法,该方法在内部使用setViewControllers。 (我一直在遇到一些线程问题,其中相同的视图控制器被推两次。)