Last thing to understand (of this chapter)


#1

Hi guys and hi authors,
congrats for the great book.

I miss one thing to fully understand this chapter and that thing is this exception:

This exception is thrown when I tried expressly to present detailViewController instead of navController. I’ve perfectly understood why we’re presenting navController instead of it.

Here’s the code:

[code]- (void)addNewItem:(id)sender
{
BNRItem *newItem = [[BNRItemStore sharedStore] createItem];

DetailViewController *detailViewController = [[DetailViewController alloc] initForNewItem:YES];
[detailViewController setItem:newItem];
[detailViewController setDismissBlock:^{
    [[self tableView] reloadData];
}];

// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
// [navController setModalPresentationStyle:UIModalPresentationFormSheet];
// [navController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:detailViewController animated:YES completion:nil];

}[/code]

The question is why I get the above exception? Why it says that [i]detailViewController[/i] is an active controller? (the exception also refers to [i][/i], I’m confused)

Thank you!