我的ProfileView视图控制器nib中有一个按钮,当按下时我会显示OptionsView视图控制器。
在我的ProfileView.m文件中,我有这个是viewDidLoad:
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Options" style:UIBarButtonItemStylePlain target:self action:@selector(actionOptions)];
然后我有:
- (void)actionOptions
{
OptionsView *screen = [[OptionsView alloc] initWithNibName:@"OptionsView" bundle:Nil];
[self.view addSubview:screen.view];
}
但每当我点击按钮时,我会得到一个线程1:信号 SIGABRT ,并带有以下控制台输出:
2014-11-24 13:43:54.107 app[2161:5537921] didFailToRegisterForRemoteNotificationsWithError Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x7ff7c2c365d0 {NSLocalizedDescription=remote notifications are not supported in the simulator}
2014-11-24 13:43:55.673 app[2161:5537921] *** Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/UITableView.m:7344
2014-11-24 13:43:55.676 app[2161:5537921] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
答案 0 :(得分:0)
你有SIGABRT,因为在OptionsView中显示的tableview的数据源没有从tableView:cellForRowAtIndexPath:方法返回有效的单元格。 您发布的代码没问题。