Ios Can';t在UITableViewController中加载自定义UITableViewCell

Ios Can';t在UITableViewController中加载自定义UITableViewCell,ios,objective-c,uitableview,Ios,Objective C,Uitableview,我需要有关在UITableViewController中加载自定义UITableViewCell的帮助。预期的结果是有一个包含3个UITableViewCell的UITableViewController:其中2个是常规UITableViewCell,一个是自定义UITableView子类,名为SubscriptionContentCell。根据内容存在、不存在或仍从服务器加载的条件显示3个单元格。我对条件没有问题,但对股票有问题 - (UITableViewCell *)tableView:(

我需要有关在
UITableViewController
中加载自定义
UITableViewCell
的帮助。预期的结果是有一个包含3个
UITableViewCell
的UITableViewController:其中2个是常规UITableViewCell,一个是自定义UITableView子类,名为SubscriptionContentCell。根据内容存在、不存在或仍从服务器加载的条件显示3个单元格。我对条件没有问题,但对股票有问题

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
方法,我在其中放置了一个代码以选择适当的UITableViewCell。代码如下:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSString *cellIdentifier;
    id cell;

    if ([deactivableOrNotContents count] > 0) {
        cellIdentifier = @"subscriptionCell";
    } else {
        if (getPurchasedHasFired == true) {
            cellIdentifier = @"noContentsAvailable";
        } else {
            cellIdentifier = @"loadingCell";
        }
    }

    if ([deactivableOrNotContents count] > 0) {
        SubscriptionContentCell *contentCell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        cell = contentCell;
    } else {
        UITableViewCell *standardCell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        cell = standardCell;
    }

    // Configure the cell...
    if (cell == nil) {
        if ([deactivableOrNotContents count] > 0) {
            cell = [[SubscriptionContentCell alloc] initWithStyle:UITableViewCellStyleDefault
                                          reuseIdentifier:cellIdentifier];
        } else {
            cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                          reuseIdentifier:cellIdentifier];
        }
    }

    return cell;
}
我遇到的问题是一个
SIGABRT
在线:

SubscriptionContentCell *contentCell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
即使我导入了这个类

这是我的故事板文件中UITableViewController内的UITableView单元:


我的代码出了什么问题?

SIGABRT
消息可能由多种原因引起。最常见的一种可能是有一个
IBOutlet
,它仍在接口文件中链接,但在代码中已被删除


由于您正在从
XIB
文件加载
UITableViewCell
对象,这很可能是问题的原因。检查
SubscriptionContentCell
接口文件,查看是否有任何链接到子视图的
IBOutlet
s已从类的代码中删除。

为什么要进行两次if检查?你可以一次完成。可能是因为你在不同的地方分配了单元标识符,所以单元标识符变为零。检查XIB,看看是否有任何
IBOutlet
s集不再存在于你的代码中。你在故事板上设置了单元标识符吗?@aluminal很好-当然,我刚刚发布了一个更详细的答案。