iphone - 应用程序试图在目标 <UINavigationController : 0x2007af00> 上呈现一个无模态视图 Controller

标签 iphone objective-c ios ipad

我收到以下错误:

Application tried to present a nil modal view controller on target <UINavigationController: 0x2007af00>.

在下面的代码中:

-(void) showAddressBookDialog
{
    [self presentMailComposeViewController:nil];
}


- (void)presentMailComposeViewController:(NSString *)recipient {
    // Create the compose email view controller
    MFMailComposeViewController *composeEmailViewController = [[MFMailComposeViewController alloc] init];
    [composeEmailViewController setMailComposeDelegate:self];
    [composeEmailViewController setSubject:@"Join me on X"];
    [composeEmailViewController setToRecipients:[NSArray arrayWithObjects:recipient, nil]];
    [composeEmailViewController setMessageBody:@"" isHTML:YES];
    [composeEmailViewController setModalPresentationStyle:UIModalPresentationFormSheet];
    [self dismissModalViewControllerAnimated:NO];
    self.inviteFriendsMailComposerVC_ = composeEmailViewController;
    //[self.navigationController presentModalViewController:composeEmailViewController animated:YES];
    [self.navigationController presentViewController:composeEmailViewController animated:YES completion:nil];
    [composeEmailViewController release];
}

知道为什么吗?

最佳答案

我想知道你为什么要首先关闭你的 View ...从你的方法中删除这一行

[self dismissModalViewControllerAnimated:NO];

最好先检查设备是否配置为发送电子邮件。看这个link

关于iphone - 应用程序试图在目标 <UINavigationController : 0x2007af00> 上呈现一个无模态视图 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12558910/

相关文章:

iPhone SQLite日期问题

ios - UIScrollView 自动旋转问题 - subview 坚持原始位置并同时移动到新位置

iphone - 图片命名约定困惑与UIBarButtonItem

ios - 我使用递归对 Twitter 好友进行分页的代码不起作用 - iOS

iphone - 如何从 NSDictionary 获取数据到 NSArray

iphone - 如何更改 iOS SDK 中的默认导航速度?

iphone - 需要有关 iphone 崩溃日志的帮助。身边有高手吗?

ios - 添加一个简单的 UIView 作为 UICollectionView 的标题

iphone - 这里如何获取和修改一个像素值?

ios - 快速限制在 UITextView 中复制和粘贴的字符限制?