在我的 prepareForSegue 方法中,我正在这样做:
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];
在我的initWithContext
方法中:
- (void)initWithContext:(TestSRConnectionContext *)__context{
_context = __context;
NSLog(@"Ok init for user %@ with %d zombies", __context.userName, _context.zombies.count);
}
在日志中一切都很好。
我正在加载的视图是 UITableViewController 但没有加载任何项目。我以前有这个表工作过,所以表的逻辑没问题。
所以 - 我遇到的问题是视图出现时 _context.zombies 设置为 null;在 viewDidAppear 方法中,我检查了 _context.zombies,它为空!