I'm new to Xcode and am having problems with the IDE crashing when I use the Interface Builder. This is Xcode 4.5.
It worked properly for long enough for me to add a dozen or so buttons to the storyboard -- but when I try to resize any of them, it crashes and quits. If I move a button, it crashes. If I add a new object like a label, it sometimes crashes, but not always.
If I don't try to edit the storyboard, the project builds and runs on the simulator with no problems.
I've pasted what looks like the relevant part of the crash report below. To save space, I've deleted everything from the 'view hierarchy' section downwards, but I can add it if it's useful. All the crash reports refer to the same error.
Interestingly, when I look at the Console log, there's another report from Interface Builder before each of these crashes:
25/09/2012 10:46:35.661 Interface Builder Cocoa Touch Tool: CFPreferences:
user home directory at file://localhost/Users/me/Library/Application Support/
iPhone Simulator/User/ is unavailable. User domains will be volatile.
It's correct -- that directory doesn't exist. I've got iPhone Simulator/6.0, but nothing else. I'm logged in as the user in that path.
Based on other suggestions on Stack Overflow and elsewhere, I've tried cleaning the build then deleting the entire iPhone Simulator directory and letting the simulator recreate it, but that makes no difference.
As an experiment, I've just created a new Project and dragged some buttons and labels into the storyboard. That seems fine. No crashes.
Does that suggest that something has got corrupted in my other project?
Any suggestions would be very welcome. This is not an important project -- I'm learning my way around at this stage -- but if something is causing problems then I want to sort it out before I start any serious work in Xcode.
Thanks in advance.
James
Process: Xcode [650]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 4.5 (1839)
Build Info: IDEApplication-1839000000000000~3
App Item ID: 497799835
App External ID: 10747437
Code Type: X86-64 (Native)
Parent Process: launchd [129]
Date/Time: 2012-09-25 10:46:43.202 +0100
OS Version: Mac OS X 10.7.5 (11G56)
Report Version: 9
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Application Specific Information:
ProductBuildVersion: 4G182
ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilderCocoaTouch/IDEInterfaceBuilderCocoaTouch-1926/IBPlugin/Utilities/IBObjectMarshalling.m:651
Details: Failed to arbitrate IBNSLayoutConstraint, IBUIButton, IBUILabel, IBUIView, and IBUIViewController.
Interface Builder encountered an error communicating with the iOS Simulator. If you choose to file a crash report or radar for this issue, please check Console.app for crash reports for "Interface Builder Cocoa Touch Tool" and include their content in your crash report.
Exception name: IBAssertionFailure
Exception reason: ASSERTION FAILURE:
Reason: All views needing candidate constraints have already had constraints generated. This most likely indicates a bug involving layout of the following views:
Layout engine frame ({{20, 60}, {282, 57}}) of <UILabel: 0xb36f590; frame = (20 60; 281 57); text = '0'; clipsToBounds = YES; opaque = NO; autoresize = TM+BM; userInteractionEnabled = NO; layer = <CALayer: 0xb36f620>> does not match canvas frame ({{20, 60}, {281, 57}})
Layout engine frame ({{236, 328}, {66, 43}}) of <UIRoundedRectButton: 0xb384590; frame = (236 328; 65 44); opaque = NO; autoresize = TM+BM; layer = <CALayer: 0xb384660>> does not match canvas frame ({{236, 328}, {65, 43}})
Layout engine frame ({{236, 124}, {66, 43}}) of <UIRoundedRectButton: 0xb38ea10; frame = (236 124; 65 44); opaque = NO; autoresize = TM+BM; layer = <CALayer: 0xb38eae0>> does not match canvas frame ({{236, 124}, {65, 43}})
Layout engine frame ({{236, 175}, {66, 43}}) of <UIRoundedRectButton: 0xb390a30; frame = (236 175; 65 44); opaque = NO; autoresize = TM+BM; layer = <CALayer: 0xb36e8e0>> does not match canvas frame ({{236, 175}, {65, 43}})
Layout engine frame ({{236, 226}, {66, 43}}) of <UIRoundedRectButton: 0xb392a90; frame = (236 226; 65 44); opaque = NO; autoresize = TM+BM; layer = <CALayer: 0xb392b60>> does not match canvas frame ({{236, 226}, {65, 43}})
Layout engine frame ({{236, 277}, {66, 43}}) of <UIRoundedRectButton: 0xb394b70; frame = (236 277; 65 44); opaque = NO; autoresize = TM+BM; layer = <CALayer: 0xb394c40>> does not match canvas frame ({{236, 277}, {65, 43}})
After looking at the pros and cons of both Storyboard and SwiftUI, according to my opinion building app UI using storyboard is comparatively easier for a beginner, and has been there was a very long time, but there are some flaws with it and that flaws have been taken care of in Swift UI.
Storyboarding is a feature built into Xcode that allows both the various screens that comprise an iOS application and the navigation path through those screens to be visually assembled.
We no longer have to argue about programmatic or storyboard-based design, because SwiftUI gives us both at the same time.
Update: Further experimentation revealed the 'Use Autolayout' checkbox for the storyboard. Switching this off then saving the file seems to have fixed the problem. I can edit at will, with no more crashes.
When xib files are in different formats, but are all in the same project, this will happen. In my case, some xib files were compatible for xcode5 dp, but others were for xcode 4.6
The object here is to look for differences in xib files
Hope this helps people in the future!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With