gpt4 book ai didi

ios - 应用程序在设备上崩溃但在模拟器中没有崩溃 :[UITableViewController loadView] loaded the "XXXViewController" nib but didn't get a UITableView. '

转载 作者:行者123 更新时间:2023-11-29 03:21:53 24 4
gpt4 key购买 nike

在 IOS 模拟器上运行我的应用程序时它工作正常,但如果我在我的设备上运行它,我会收到下一个错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "XXXViewController" nib but didn't get a UITableView.'

这可能是一个错误,因为它在 iOS 模拟器中运行。有谁知道如何解决这一问题?

我已经将我的 View Controller 设置为

@interface XXXViewController : UITableViewController <UITableViewDataSource, UITableViewDelegate>

我以编程方式创建了 View ,因此没有 xib 文件(也没有 Storyboard)。

最佳答案

添加

- (id)initWithStyle:(UITableViewStyle)style
{
return [self init];
}

解决了问题。正如我在

-(id)init
{
// Call the superclass's designated initializer
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {
...
}
return self;
}

关于ios - 应用程序在设备上崩溃但在模拟器中没有崩溃 :[UITableViewController loadView] loaded the "XXXViewController" nib but didn't get a UITableView. ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20974341/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com