20

*** 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.

ali
  • 481
  • 5
  • 15
  • Possible duplicate of [Could not instantiate class named IBNSLayoutConstraint](http://stackoverflow.com/questions/24095318/could-not-instantiate-class-named-ibnslayoutconstraint) – Sandy Chapman Jan 12 '16 at 00:23

9 Answers9

24

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

Arvind Kumar
  • 2,371
  • 1
  • 18
  • 25
  • 3
    Did you also then re-enable size classes? For most apps, you absolutely SHOULD be using size classes, so keeping this turned off is probably either the wrong answer or indicative of a bug that should be filed. – Daniel J Dec 14 '15 at 21:28
  • You are a life saver, but i wonder if this occurs at random times and this is the solution for it, do we have to apply this solution to every storyboard before sending to store ? – Suat KARAKUSOGLU Dec 18 '15 at 09:10
  • @DanielJ for me it was fine after I turned size classes back on; definitely seems to be a bug though – Paulw11 Dec 18 '15 at 23:06
  • Disabling & running fixed the problem. I was then able to re-Enable size classes, and the problem stayed fixed. – John Fowler Dec 28 '15 at 15:39
  • This removes (disabling and re-enabling) some `` entries from the storyboard xml, but couldn't find any negative effect, app continues working normally. – User Feb 13 '16 at 08:46
10

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

Evgeny Mikhaylov
  • 1,696
  • 1
  • 19
  • 25
  • Your answer and @Kayron Cabral's answer below seem to point to the same problem. Both your solutions are equivalent, it seems. – verybadalloc Dec 19 '15 at 20:45
4

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

Community
  • 1
  • 1
eakgul
  • 3,658
  • 21
  • 33
  • Yes. Unfortunately I missed that. I have two storyboard. and i just change some constraints only one. Thanks for your answer. It helps me solve this problem. – ali Dec 11 '15 at 09:40
3

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

  • Your answer and @Evgeny Mikhaylov's answer below seem to point to the same problem. Both your solutions are equivalent, it seems. – verybadalloc Dec 19 '15 at 20:46
1

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

vedrano
  • 2,961
  • 1
  • 28
  • 25
  • Yes. You are right. generally I use this method when storyboards elements are not installed. it is exactly easiest way to install all element in storyboard. Thanks – ali Dec 17 '15 at 06:09
  • You are welcome. Also, you can up vote if that helped any. – vedrano Dec 17 '15 at 21:11
1

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.

Özgür
  • 8,077
  • 2
  • 68
  • 66
1

Try checking "Use Size Classes":

enter image description here

Jeffrey Bosboom
  • 13,313
  • 16
  • 79
  • 92
D.p
  • 11
  • 1
0

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.

Steven
  • 762
  • 1
  • 10
  • 27
  • Thanks for your answer John. But I checked all constarints placeholder. All of them are unselected. – ali Dec 11 '15 at 07:23
0

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

saltwat5r
  • 1,107
  • 13
  • 21