Xcode Error: Outlets cannot be connected to repeating content

Xcode Error: Outlets cannot be connected to repeating content

经过一些搜索和编辑后,我似乎无法找到修复此错误的解决方案。我正在尝试 link 我的位置搜索结果 table 以列表形式显示搜索结果。

我的地图带有详细信息按钮 link 使用名为 'FirstViewController.' 的 UIViewController 编辑我的结果 table 使用名为 'ResultsTableViewController.' 的 UITableViewController link 编辑] 我的原型单元 link 使用名为 'ResultsTableCell' 的 UITableViewCell 编辑,这也是我的插座所在的位置。

这是 2 个不同的错误:

Illegal Configuration: The nameLabel outlet from the ResultsTableViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

Illegal Configuration: The phoneLabel outlet from the ResultsTableViewController to the UILabel is invalid. Outlets cannot be connected to repeating content.

我已经阅读了其他人有同样问题的帖子,尝试相应地修复它们,但我仍然遇到同样的错误。

这是用于填充单元格的代码,位于我的 ResultsTableViewController 中。

let cell = tableView.dequeueReusableCellWithIdentifier("resultCell", forIndexPath: indexPath) as! ResultsTableCell

    // Configure the cell...
    let row = indexPath.row
    let item = mapItems[row]
    cell.nameLabel.text = item.name
    cell.phoneLabel.text = item.phoneNumber
    return cell
}

我的 ResultsTableCell 中的代码 class:

import UIKit

class ResultsTableCell: UITableViewCell {
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var phoneLabel: UILabel!
}

仅当您将其连接到视图控制器时才会出现此消息。正如我已经评论过的,您可能没有删除您对视图控制器所做的第一个连接插座。即使您从视图控制器中删除了 IBOutlet 代码,您仍然需要右键单击它并删除可能仍然存在的旧连接。删除后,错误消息将消失。

当您从 class 中删除视图但在您的视图

中仍有参考时,就会出现此问题

这里是示例,我从 class 中删除了后出口参考,但我的视图仍然保留参考 注意黄色矩形 只需单击 x [=11 将其删除=]

如果您想知道如何到达此视图,请打开您的故事板,右键单击左上角的黄色,它会显示此对话框