Migrating project to Xcode 7.2 on OS X El Capitan breaks the build
Asked Answered
B

4

6

I was running OS X Mavericks before with Xcode 7.1, I just updated to OS X El Capitan and Xcode 7.2. My app was launching fine on the simulator and device without any kind of warnings for storyboard. Now I see a bunch of warnings for missing constraints in storyboard and the app crashes with this error:

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

I also tried the solution posted on here : Could not instantiate class named IBNSLayoutConstraint

I couldn't find placeholder="YES" anywhere in xml and my storyboard is too big to actually go through each constraint to see if I by mistake have turned on Placeholder checkbox for any constraint.

I do see the following warnings when viewing xml of the storyboard.

enter image description here

Bilinear answered 9/12, 2015 at 23:48 Comment(3)
@SandyChapman : I'm sorry, I didn't get that. Could you please elaborate?Bilinear
@SandyChapman : pastebin.com/NxAdh3q7Bilinear
i have the same problem in one of my projects.. can't figure out why .. i reverted back to 7.1.1Oomph
D
5

You're in fact not using a Storyboard, but a Xib. In your file you'll find sections such as this:

<mask key="constraints">
    <exclude reference="6fq-cy-xp8"/>
</mask>

You'll want to open your .xib as "Source Code" and remove these so that the constraints become installed.

Downatheel answered 10/12, 2015 at 0:24 Comment(2)
That did work! I don't understand whether they were always there or whether they got added while migration. Do you know if anything can be done in IB to ensure it doesn't happen again?Bilinear
Usually this doesn't happen unless you check the tick box in IB to disable the "installed" state.Downatheel
S
1

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

Secessionist answered 11/12, 2015 at 15:26 Comment(1)
Isn't that basically the same thing as saying, "destroy your user interface and then re-build it"? Apps with a large UI would lose almost all of their size class configuration by disabling size classes. This work-around should really only be considered a "nuclear" option as a last resort.Manriquez
O
0

well mainly make sure that when you’re using IB to check that you don’t have any constraints with the “installed” checkbox checked if the view they belong to is “not installed”. Xcode 7.1 doesn’t even give a warning about this, but 7.2 causes a crash

Oomph answered 14/12, 2015 at 21:0 Comment(1)
For each of the constraint on the storyboard, at least one "installed" checkbox is checked by default. I don't know how that works or what different checkboxes mean but they seem to not cause any issues.Bilinear
M
0

Disable AutoLayout on your storyboard. This should fix your problem.

Mojave answered 11/1, 2016 at 7:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.