Here is my prepareForSegue:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if ([segue.identifier isEqual:@"cameraToRollsSegue"]){ ALRollsTableViewController *rollsTableViewController = (ALRollsTableViewController *)[segue destinationViewController]; Camera *c = [self.fetchedResultsController objectAtIndexPath:[self.tableView indexPathForSelectedRow]]; NSLog(@"CAMERA FROM INSIDE PREPARE FOR SEQUE: %@", c); rollsTableViewController.selectedCamera = c; }
}
I verify that the camera is not null in the NSLog:
CAMERA FROM INSIDE PREPARE FOR SEQUE: <Camera: 0x8dc1400> (entity: Camera; id: 0x8dafba0 <x-coredata:
ALRollsTableViewController viewDidLoad:
- (void)viewDidLoad { NSLog (@"ROLLS TABLE VIEW CONTROLLER : viewDidLoad!"); NSLog(@"(selected camera = %@", self.selectedCamera); }
leads to:
ROLLS TABLE VIEW CONTROLLER : viewDidLoad! (selected camera = (null)
What can I do wrong here when the property is not set?
UPDATE
With matte help, I determined that the instance of my destination controller in my readyForSeque file does not match the actual view controller:
rollsTableViewController FROM SEGUE: <ALRollViewController: 0x8d90bf0> rollsTableViewController FROM viewDidLoad in rollsTableViewController: <ALRollsTableViewController: 0x8c5ab00>
I do not know why this is so or what to do to fix it.
source share