8
votes

After doing some searching and editing, I can't seem to find a solution to fixing this error. I'm trying to link my location search results with a table to display the search results in a list-form.

I have my map with the details button linked with a UIViewController called 'FirstViewController.' My results table is linked with a UITableViewController called 'ResultsTableViewController.' My prototype cells are linked with a UITableViewCell called 'ResultsTableCell' which is also where my outlets are located.

Here are the 2 separate errors:

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.

I've read other people's posts with the same problem, tried to fix them accordingly and I'm still getting the same error.

Here is the code for populating the cell, located in my 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
}

The code in my ResultsTableCell class:

import UIKit

class ResultsTableCell: UITableViewCell {
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var phoneLabel: UILabel!
}
2
You need to connect your outlet to the custom cell not to the view controller - Leo Dabus
That's what I've done already. "@IBOutlet weak var nameLabel: UILabel!" "@IBOutlet weak var phoneLabel: UILabel!" - Alec
Show your custom cell and how you populate your table view - Leo Dabus
Show ResultsTableCell class - Leo Dabus
You probably did not delete the first connection outlet you've made. This message only occurs if you connect it to the view controller. - Leo Dabus

2 Answers

21
votes

This message only occurs if you connect it to the view controller. As I have already commented, you probably did not delete the first connection outlet you've made to your view controller. Even if you delete the IBOutlet code from your view controller you still need to right click it and delete the old connection that probably still there. After deleting it the error message will go away.

0
votes

this issue happen when you delete view from your class but still have reference in your view

here is example I remove back outlet reference from my class but my view still keep the reference Notice yellow rectangle just delete it by click at x

if you want to know how to reach this view , open your storyboard , right click at top left yellow it will show this dialog

enter image description here