Storyboard warning: prototype table cells must have reuse identifiers
IphoneIosXcodeStoryboardIphone Problem Overview
I am getting this warning from storyboard - prototype table cells must have reuse identifiers.
I have renamed the identifier in the attributes inspector but it does not seem to have removed the warning.
Any suggestions?
Iphone Solutions
Solution 1 - Iphone
To shut up the warning you have to give a name to the cell identifier :
Solution 2 - Iphone
Another way is to set the Table View 'Prototype Cells' property to zero in Attributes Inspector, if you are defining the cell using a .xib programatically.
Solution 3 - Iphone
As storyboard is actually XML file, so another trick is to open your storyboard with any text editor (not Xcode!) and try to find all tableViewCell nodes. For example press CMD+F, type <tableViewCell contentMode="scaleToFill"
and press Enter. You will probably find out, the rows same to this one:
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="GenericCellID" id="kBr-Qn-Tki">
Please pay your attention on reuseIdentifier="GenericCellID"
key value.
The rows which fire the warning (without reuse identifiers) will not have such key value. Look nodes above in your text editor and you will see tableViewController
node with class name you need to check in Xcode's storyboard editor and fix, according to aleroot' answer.
Solution 4 - Iphone
If your Xcode warning still doesn't go away even after you have set the reuseIdentifier, then try Menu "Product -> Clean". This helped for me and after that, the warning didn't show up anymore.
Solution 5 - Iphone
Since double-clicking this warning can lead to a bit of a wild goose chase (the specific UITableViewCell doesn't get selected), just wanted to add that while some of these warnings will auto-resolve, some will not.
If you are confident you've tagged all your cells in Storyboard, rebuild the project - your warning may disappear (as did mine).
Solution 6 - Iphone
A hail mary: restarting XCode worked for me (but it was probably just a manual rebuild that was required).
Solution 7 - Iphone
I got this warning for Xcode 7. I am working with Swift. I did not added the navigation controller for the initial view controller. When I did so.. I got this warning from StoryBoard. What I did is:
- There are two segues
- from Navigation Controller to Root view Controller and
- from Root View controller to your initial View controller.
- Select the segue connecting the root view controller to the initial view controller.
- Name the identifier
- Select the "Prototype" written part of the controller--> there you will see identifier as an option.
- Paste the same name of the identifier as entered earlier.
The warning goes.. if not clean the sdk :)
Solution 8 - Iphone
Be sure that you are setting the Reuse Identifier on the object, rather than the Restoration ID. Both are available via the storyboard, and easily confused.
In the storyboard XML file you'll want to be setting reuseIdentifier
, not restorationIdentifier
.
Solution 9 - Iphone
I've noticed that this error occurs when you have multiple prototype cells (in the tableview properties) and have not given all of them re-use identifiers.
Solution 10 - Iphone
The identifier is the name you refer to in you .m file. When it is not filled it is not possible to reference the cell.
Solution 11 - Iphone
This for setting reuse identifier by programmatically
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath (NSIndexPath*)indexPath
{
static NSString *cellIdentifier = @"wot";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
if (!cell)
cell = [[UITableViewCell alloc] initWithStyle: someStyle reuseIdentifier: cellIdentifier];
return cell;
}