20
votes

*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named IBNSLayoutConstraint'

I just update Xcode to 7.2 then i start to check is everything alright. but I have this error and it crashes. I dig this problem, everybody said that "Make sure you don't have any constraints installed for views that aren't installed." but I don't have any uninstalled constrains. and I don't have any NSLayoutConstraint outlets. Thanks a lot.

9

9 Answers

4
votes

You probably using InterfaceBuilder Storyboard for localization. You should also consider them and remove inactive constraits inside them or use Localizable Strings for localization.

You can also check this answer.

Storyyboard localization section

24
votes

Select Storyboard Disable Size class resolve my problem. Hope this will help you! Thanks After build your project you can again enable size class.

enter image description here

10
votes

In my case I had "padView" that was not installed in any/any size class and was installed in regular/regular size class, but it's subviews were installed in all size classes.

enter image description here

"PadView" settings:

enter image description here

"PadView" subviews settings:

enter image description here

When I changed "PadView" subviews installation settings to the same as "PadView" settings my problem was resolved.

enter image description here

3
votes

I had a view deactivated (not installed) in my main view in IB. I deleted it and also deleted all the constraints without reference to IB. And worked for me.

View deactivated

Attributes inspector

1
votes

I have an app that sets custom size classes for iPad so app recognizes Portrait and Landscape orientations as Regular/Compact and Compact/Regular traits.

So, when I had one view installed only as both R/C Installed and C/R Installed, I got crash: 'Could not instantiate class named IBNSLayoutConstraint' when I upgraded to 7.2 final.

Fix is very simple: to add view install for Any/Any: "Installed"

By comparing Storyboard source it appears that this line was removed after fixing:

// y4d-LA-PwQ is view specific ID

1
votes

Try checking "Use Size Classes":

enter image description here

1
votes

It is easy to solve without applying the hackery mentioned in the above answer. Switch your IB to any/any and look through the subviews of each topview. If you find a super view that is not installed and subview of it installed, disable this installed subview in any/any so that the super view and the subviews will have same status of installation.

0
votes

I did have a similar issue in where I received a "Could not instantiate class named IBNSLayoutContraint" error when one of my apps loaded my XIBs. It ended up being one of my contraints had a check mark on it's properties. It was something like "Remove from Build". I unchecked it and resolved my error. I don't think this is the solution to your problem.

0
votes

Try to remove the conflicting constraint and add it again ;)