why Xcode 7.2 crash 'Could not instantiate class named IBNSLayoutConstraint'?
Asked Answered
C

9

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.

Cartierbresson answered 10/12, 2015 at 13:4 Comment(1)
Possible duplicate of Could not instantiate class named IBNSLayoutConstraintReber
P
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

Paripinnate answered 11/12, 2015 at 9:25 Comment(1)
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.Cartierbresson
R
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

Reynoso answered 11/12, 2015 at 15:25 Comment(5)
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.Redeploy
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 ?Gromme
@DanielJ for me it was fine after I turned size classes back on; definitely seems to be a bug thoughCoupling
Disabling & running fixed the problem. I was then able to re-Enable size classes, and the problem stayed fixed.Clementineclementis
This removes (disabling and re-enabling) some <constraint> entries from the storyboard xml, but couldn't find any negative effect, app continues working normally.Rugging
B
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

Bulbil answered 16/12, 2015 at 11:28 Comment(1)
Your answer and @Kayron Cabral's answer below seem to point to the same problem. Both your solutions are equivalent, it seems.Cystine
P
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

Paripinnate answered 11/12, 2015 at 9:25 Comment(1)
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.Cartierbresson
A
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

Atomy answered 14/12, 2015 at 19:15 Comment(1)
Your answer and @Evgeny Mikhaylov's answer below seem to point to the same problem. Both your solutions are equivalent, it seems.Cystine
I
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

Illustrious answered 16/12, 2015 at 22:15 Comment(2)
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. ThanksCartierbresson
You are welcome. Also, you can up vote if that helped any.Illustrious
D
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.

Doolie answered 15/2, 2016 at 17:56 Comment(0)
M
1

Try checking "Use Size Classes":

enter image description here

Mullein answered 11/3, 2016 at 5:46 Comment(0)
A
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.

Ancohuma answered 10/12, 2015 at 23:45 Comment(1)
Thanks for your answer John. But I checked all constarints placeholder. All of them are unselected.Cartierbresson
T
0

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

Tic answered 29/7, 2020 at 10:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.