我有方法
- (void)viewDidAppear:(BOOL)animated
{
[self updateViews];
}
- (void) updateViews
{
NSInteger itemIndex = [[DataController sharedInstance] indexFromObjectProperty:itemUUID];
if (itemIndex == NSNotFound) {
[self.navigationController popViewControllerAnimated:YES];
}
NSDictionary *item = [[[DataController sharedInstance] getItems] objectAtIndex:itemIndex];
}
我不需要加载视图以防 itemIndex == NSNotFound 但在调试模式下调用此字符串,然后访问下一个字符串并导致异常。如何停止更新视图并显示根视图控制器?