Note that there are some explanatory texts on larger screens.

plurals
  1. POIOS Modal View Controller Presents Black Screen
    text
    copied!<p>I am working on an IOS app and have been stumped by this problem for about a week now and cannot find a solution. Any help you can offer would be greatly appreciated. Here's my set-up:</p> <ol> <li>I have a tab bar controller.</li> <li>I have a TableViewController which has a navigation bar with a navigation item "Add".</li> <li>After you press the "Add" selector I am modally presenting another viewController that has a picker on it.</li> <li>I am using Core Data.</li> </ol> <p>When the second view controller is modally presented it comes up with a black screen with a navigation bar. If I access the second view controller from an unrelated screen modally it comes up fine without the navigation bar.</p> <p>No error message is logged, not even that the object wasn't saved when you press the "save" on the navigation bar. However, pressing "save" will bring you back to the TableViewController and it looks like the entity was added.</p> <p>Here is the code in my TableViewController:</p> <pre><code>- (void)add:(id)sender { SecondViewController *addController = [[SecondViewController alloc] init]; addController.delegate = self; Entity *newEntity = [NSEntityDescription insertNewObjectForEntityForName:@"Entity" inManagedObjectContext:self.managedObjectContext]; addController.entity = newEntity; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addController]; [self.navigationController presentModalViewController:navController animated:YES]; } - (void)secondViewController:(SecondViewController *)secondViewController didAddEntity:(Entity *)entity { if (entity) { [self showEntity:entity animated:NO]; } [self dismissModalViewControllerAnimated:YES]; } - (void)showEntity:(Entity *)entity animated:(BOOL)animated { EntityDetailTableViewController *detailViewController = [[EntityDetailTableViewController alloc] initWithStyle:UITableViewStyleGrouped]; detailViewController.entity = entity; [self.navigationController pushViewController:detailViewController animated:animated]; } </code></pre> <p>Here is the code in my second View Controller:</p> <pre><code>- (void) save { entity.attribute = attributeTextField.text; NSError *error = nil; if (![entity.managedObjectContext save:&amp;error]) { NSLog(@"Problem saving attribute: %@", [error localizedDescription]); } NSLog(@"saveAttribute"); [self.delegate secondViewController:self didAddEntity:entity]; } </code></pre> <p>Any suggestions on where to go from here would be really helpful. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload