Storyboard warning: prototype table cells must have reuse identifiers

前端 未结 11 1025
礼貌的吻别
礼貌的吻别 2020-12-07 19:36

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

相关标签:
11条回答
  • 2020-12-07 20:14

    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:

    1. There are two segues
      1. from Navigation Controller to Root view Controller and
      2. from Root View controller to your initial View controller.
    2. Select the segue connecting the root view controller to the initial view controller.
    3. Name the identifier
    4. Select the "Prototype" written part of the controller--> there you will see identifier as an option.
    5. Paste the same name of the identifier as entered earlier.

    The warning goes.. if not clean the sdk :)

    0 讨论(0)
  • 2020-12-07 20:14

    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.

    0 讨论(0)
  • 2020-12-07 20:17

    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.

    0 讨论(0)
  • 2020-12-07 20:20

    A hail mary: restarting XCode worked for me (but it was probably just a manual rebuild that was required).

    0 讨论(0)
  • 2020-12-07 20:25

    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.

    0 讨论(0)
提交回复
热议问题