Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Error: Outlets cannot be connected to repeating content

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!
}
like image 736
Alec Avatar asked May 02 '15 22:05

Alec


1 Answers

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.

like image 101
Leo Dabus Avatar answered Oct 23 '22 11:10

Leo Dabus