In my prepareForSegue method I’m doing this:
LoggedInViewController *view = segue.destinationViewController;
NSLog(@"Preparing for view logged in for user %@ with %d zombies with %@",
self.context.userName, self.context.zombies.count, view.view);
[view initWithContext:self.context];
And in my initWithContext-method:
- (void)initWithContext:(TestSRConnectionContext *)__context{
_context = __context;
NSLog(@"Ok init for user %@ with %d zombies", __context.userName, _context.zombies.count);
}
In the log everything is fine.
The view I’m loading is a UITableViewController but no items gets loaded. I have had this table working before so the logic for the table is OK.
So — the problem I’m having is the _context.zombies is set to null when the view appears; in the viewDidAppear method i check _context.zombies and it is null!
I had written the question wrong – context wasn’t null but rather context.zombies was.
I changed the weak attribute on the property declaration for it to strong and now it works.