Xcode 5.1 bug? I keep getting 'NSUnkownKeyException'


#1

This hit me last week and I thought it was me.

It still MIGHT be me but I thought it was worth sharing.

If you see THIS error on the last step in the Dynamic Type exercise after DELETING the Width Constraint from your BNRItemCell.m file:

What I did to FIX this is the following:

Open the xib file by right clicking and selecting ‘Open As’ - > ‘Source Code’

Then click inside the text window and hit CTRL-F to do a find and paste in: imageViewWidthConstraint
Then delete that line from the xib file.

Very odd but that fixed it for me.

When deleting the item from the source code it did NOT delete it from this XML node.

<connections>
                <outlet property="imageViewHeightConstraint" destination="AB6-PS-iev" id="lN1-YE-QVL"/>
--->delete <outlet property="imageViewWidthConstraint" destination="BVN-W3-V6S" id="0Cw-pY-bOr"/>
                <outlet property="nameLabel" destination="3Fg-65-Ari" id="tAa-nj-ZL2"/>
                <outlet property="serialNumberLabel" destination="mXN-eK-de0" id="Jlk-9W-2l5"/>
                <outlet property="thumbnailView" destination="M2k-15-jqr" id="uNE-KY-vgy"/>
                <outlet property="valueLabel" destination="bJe-JW-A79" id="95X-WN-Cei"/>
</connections>

#2

Everything’s a 5.1 bug with you!
I had the same problem. You need to delete the outlet connection for the constraint in the XIB file. They do tell you to do this on p400 (third paragraph from the bottom). Just right click on the constraint in the lefthand menu and click on the little x to remove the outlet connection. Nothing to do with 5.1.


#3

I had similar case in one of previous chapters. App kept crashing and console logs weren’t helpful. Finally, it turned out that I set class ‘BNRItemCell’ not on ‘Item Cell,’ but on ‘File’s Owner.’ So, whenever action method was called, the app crashed due to missing selector. Though I had hard time to find the cause, I learned that while the bug with xib file is not easy to solve, we can suspect connections in xib file at first if some mysterious bug happens.