Storyboard crashes Xcode when opened - ios

Whenever I attempt to open up my storyboard, Xcode crashes with the following error report
The funny thing is, the app works fine in the simulator and builds without errors. What is causing this crash? I see two possible crashes:
Exception reason: UITableView dataSource is not set
, but that shouldn't make the storyboard crash right?
Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.
Which doesn't give much information at all.
I have been using a storyboard with Xcode 5 for some time, so the question does not appear to be related to moving from Xcode 4 to 5. I can open the storyboard as XML and I can open my iPhone storyboard just fine.

If you are using git, I would recommend reverting to a time before this problem started.
If you are not using git, and you are absolutely sure you did not edit the xml for the storyboard then I would say:
1)find the storyboard file using the finder.
2)copy it to your desktop.
3)go back to Xcode and delete the storyboard from your project, select "move to trash". 4)re-import the storyboard file into your project.
Ive had similar problems with Xcode 5 and either reverting using git or the steps above usually get me back up and running.

Exception reason: UITableView dataSource is not set
Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.
The errors described above lead me to think that one if not all viewcontroller(s) for the items listed above lost their connectivity to viewcontroller.h / viewcontroller.m files. I would make sure you have everything wired up correctly, and you can check this by making sure the items in your viewcontroller have a circle in the gutter (next to the line numbers) that is filled in (solid) if the circle is not filled in then it means your items are not wired up to your viewcontroller. I would post a picture of your .h / .m file of your viewcontroller so we can further investigate.

I ended up copying each view controller scene (in XML) into a new storyboard. Some view controllers could not be copied without the storyboard crashing so I had to recreate about 4 of them, but by and large I got the majority of my work back.

What you need to do is reopen the project again in Xcode 5 and then go to the storyboard. Then at the right side choose for "Identity and type" and then set "opens in" to Xcode 4.6 to be able to open it in Xcode 4.6. And disable auto layout, somehow when you open it in xcode 5 it asks you to update it, I think you did that without a thought, happened to me as well :)

Related

Xcode runtime error Could not load the "_IBBrokenImage_"

I am working on an app (Xcode 11.4, iOS 13) with several view controllers. While running on simulator or device, when I navigate to a specific VC, the debugger emits a:
"`Could not load the "_IBBrokenImage_" image referenced from a nib in the bundle with identifier ...`"
This particular VC does not have any images, just text in buttons, labels and a UITable. It does not trigger standard Swift or Exception breakpoints. Is there a specific Method iOS uses to pull image resources that I might try to trap this with? Alternatively, is there a different approach to finding the issue being complained about?
Thanks!
This happened to me when I updated to Xcode 11.4. For some reason, my UIBarButtonItem's image was set as Unkown Image in storyboard. I just had to initialize the image again.
Here is the answer (and if is due to buggy IB in Xcode 11.4):
Re-examination of the XML of the storyboard file revealed that Xcode had added,
on its own, a variation for RC (landscape) orientation. I didn't do it! The variation image was a random string, basically unassigned.
Also, the IB frequently complains that it can not compile by XML from time to time.
I think a new release of Xcode would be helpful!
VC3 -- click --> VC1 -- programmatically go to --> VC2
I got this error when app is going to another viewcontroller(VC2) too quickly (programmatically - in my case) before the current viewcontroller (VC1) has finished loading all of its images in nib. In my case, the app travels from VC3 to VC1 and from VC1 to VC2 continuously. So I had changed the app to go from VC3 to VC2 directly and the error has gone. I hope this will be applied to a similar situation.
I had this issue on Xcode 13.2.1 when I unselected 'Installed' on a view in XIB. Deleting the view (I no longer needed it) resolved the error for me.
Change the image to another run and see if it shows, then change it back to the previous image.

IB Designables: Failed to render and update auto layout status - The agent crashed

I am working on an existing iOS Project in Xcode 10.2.1 on macOS 10.14.4. The uses mainly Objectiv-C but also some Swift Pods (v. 1.5.2). Recently I have also added the first Swift based ViewController using Swift 5.
The Problem:
When working on the XIB file of this Swift bases ViewController after a short time the following error message is shown in the Xcode sidebar:
IB Designables: Failed to render and update auto layout status for
ViewXYZ (abc-de-123): The agent crashed
As soon as there error occur no changes in the Interface Builder (added view, changed colors, text, etc.) are shown anymore. When I re-open the XIB file it only show grey view placeholders instead of the real content.
The problem can only be solved by re-starting Xcode but when working on the XIB again it shows up after again after just a few moment.
Things that did NOT work
Since the problem is realted to IB Designabales I checked these first. Within the ViewController I am using two different custom views which are implemented in Objective-C and marked as IB_DESIGNABLE.
These views have not been changed recently and it was never a problem to use them before. Removing all custom code from these views did not change the problem. Thus there seems to be nothing wrong with the implementation.
I found other topics dealing with similar issues, but none of the different solutions worked for me:
Re-starting the Mac, re-starting Xcode, cleaning the build folder or deleting ~/Library/Developer/Xcode/DerivedData does NOT solve the problem
Adding this code to the pod file does NOT solve the problem
Adding all UIView constructors to the views as proposed here does NOT solve the problem.
Xcode shows that the designables are up to date and does NOT offer a debug button (as shown here)
The views do not have orphant outlets
Re-creating the XIB from scratch let to the same issue
Not using the Bundle or other device specific code within the custom views did NOT solve the problem. As described before I removed ALL custom code from the classes so that they where simple UIView subclasses without any changes.
So far nothing I tried had any effect. However, most answers I found are quite old. Are there are any new proposals to solve this issue?

Xcode incorrectly binding Storyboard elements to Exit

Developing in Xcode 9.3 Beta 2, had some issues with with BarButtonItem (fix), but then got some crashes. So removed then re-added the logout button, but drag-and-dropping gives me this callout:
Setting the type to UIButton and name to logoutPressed, but that didn't work:
More info:
EDIT: Traced it down to wrong ViewController binding. But checking tableViewController in XML, and it has the correct customClass and customModule set. Same on the GUI. How do I rebind?
How do I get drag-and-drop component binding working again? - Or alternatively: how do I manually bind in XML?
I found a solution, launch Xcode 9.2, copy everything from your old storyboard file to a new one, delete the old one, rename the new one Main.storyboard, that fixed it for me
Make sure you drag to the right class file

Xcode crash on opening storyboard

I am developing an app for iOS with Xamarin. Lately, I haven't been able to access my storyboard file in Xcode or compile my app anymore because Xcode crashes right away when opening the .storyboard file.
The error message is the following:
ASSERTION FAILURE <br>
Details: Creating an out of band arbitration unit with a view (<IBUITableViewCell: 0x7fa88d13a5d0>) as the root under another view (<IBUITableView: 0x7fa88cf000e0>) is not yet implemented.<br>The view would need to be in two arbitration units, the one above for positioning constraints, and the root of the one below for sizing constraints. <br>But then that means that subviews cannot have constraints that affect the size of the view, so the view must have ibExternalTranslatesAutoresizingMaskIntoConstraints set to YES.
<br>Object: <IBUITableViewCell: 0x7fa88d13a5d0>
<br>Method: -ibArbitrationUnitWasCreatedWithReceiverAsRootUnderParent:
I tried rebasing my storyboard to the last version that worked (the one the app was submitted to the app store) and weirdly, even that version didn't work.
My plan was to manually remove and every view controller and add them one by one to figure out where the error is.
However I don't understand why XCode crashes when opening the storyboard and not just shows me exactly where the error in my xml is.
So if anyone has encountered this problem before and has a better way to fix it than to manually do it, I would really appreciate any help.
ibExternalTranslatesAutoresizingMaskIntoConstraints needs to be YES
Sounds like the Storyboard was created with an older Xamarin.iOS that introduce this issue.
The fastest solution is to open the storyboard in vi (or Xcode / View As Source, or another text editor of your choice, and replace all translatesAutoresizingMaskIntoConstraints="NO" with "".
Save the file, re-open it in the Storyboard editor and fix your contraints.

StoryBoard Assistant Editor stopped showing associated file

Xcode storyboard assistant editor stopped showing related files.
"Automatic" is selected and "Class" is filled in Identity Inspector.
It was working before, but know it has stopped.
"Auto" or "CounterPart" modes are still woking for other files except StoryBoard.
A few days ago, I tried to update from Xcode 5 to 6, but later on gave up.
Would that have something to do with it?
With XCode 11 onwards, you can option(alt) + click on the file that you want to view in assistant editor.
Simple Fix.
Found the solution (at least worked for me), it's the same bug that causes you not to be able to create new outlets. You must delete the [DerivedData] folder:
Close the project you are working on with.
Delete the【DerivedData】folder of you project. (This folder may inside your project's folder, or inside
~/Library/Developer/XCode/DerivedData/(your project)/ ) or somewhere
else that were setup by you.
Restart Xcode.
see here.
In same case this worked for me:
Right click on ViewController file(on left pane) and choose Delete -> Remove Reference.
Right click on folder where this ViewController file was and choose Add files to .. and add this ViewController file which your just deleted.
Profit.
Deleting the Derived Data didn't work for me nor force quitting Xcode and restarting it.
The only thing that worked was deleting both the class and the storyboard (only the reference to them) and adding them back to the project.
Hope to help someone.
If anyone is wondering how to find Assistant editor in XCode 11 then
please find the steps from the below image. You can show this options
in storyboard or Xib files on upper left corner.
Maybe it's too late but just with the keyboard, you can launch a reset for associated files.
Use the keyboard :
command + option + shift + z
You can find it in the menu Xcode->View->Assistant Editor->Reset Editor.
Click first on the assistant window, then click on 'option'+'alt' and right click on the view controller that you want.
I have Xcode 13.1 and none of these solutions is working for me, but this simple solution works for me every single time. With your Storyboard and (empty) Assistant Editor open, in the upper right of the Editor window click the "Add Editor on Right" icon Editor On Right Icon, and just as promised, it will open a new editor to the right of your Storyboard and (broken) Assistant Editor, only the Assistant in THIS window will be working! Just find the "Close Window" x on your broken editor, close it, and in its place will be your shiny new working Assistant!
Full Editor View of where to click to open the new Editor On Right
Tried all the above methods whereas after simply running the app Command + B fixed this issue and I was able to select the screen under automatic.
This command on terminal fixed my issue:
defaults write com.apple.dt.XCode IDEIndexDisable 0
simply exiting and reopening Xcode worked for me.
For Xcode 8+ versions
Check at top process indicator that if Xcode is "indexing" files... if yes, then, please wait until it finishes. Once it get finished. Your file will automatically appear as counterpart in Automatic section.
If Xcode is not showing "indexing" in process bar, then perform as #Anna Chiara's Answer
I deleted ~/Library/Developer/XCode/DerivedData -> didn't work
Xcode->View->Assistant Editor->Reset Editor is disable
Finally, I figured out that the class name of File's Owner of .xib file is incorrect (the class doesn't exist). I corrected it and Assistant Editor works again.
Hope this helps you
I had the same problem. Finally this is what worked for me.
Changing the name of the ViewController File.
Change the name of the class to the new name via the Refactor tool
Refactor tool
The only thing that ended up working for me was copying over the code from the offending ViewController files and completely deleting them, then creating new ones with the exact same name and pasting in the previous code.
The assistant then linked up to the new ViewController files with no issue.
None of these answers worked for me w/ XCode 13. However, the following worked:
Rename the ViewController class to ViewController2
Update the reference in the storyboard to ViewController2
This made the assistant editor appear.
Change the name of the class back to ViewController. Change the reference in main.storyboard back to ViewController and hit enter (Step 2)
I had same issue and spent almost 2 hours of trying different aproaches finally I found something to solve problem.
I've created two or more VC at the same swift file and I think that's why IDE confused about the files.
So I suggest that you should delete your viewcontroller class and clean than reassign class.
I hope it works for you too.
For what it is worth, this was happening to me for the last couple days on 9.3 . I had just added a new build schema for an alternate debug symbol on testflight. It was not until I removed the new schema and then deleted Derived Data and restarted did it start working again. I have re-added the new schema back in and it continues to work. Not sure what the issue was, but that is what solved it for me.
In case anyone is watching I had a bizarre instance of this (Xcode 11): I deleted a View Controller that I'd done incorrectly; dropped in a new one, created the UIView and associated. BUT I didn't bother to create the outlet from the View Controller on the previous screen. Strange that it let me work for a few minutes, then after I had turned off the assistant editor to do something else, turned it back on and only had the UIResponder.h file. Edit - this happened again. Had to delete the 'wire' to the next screen, then recreate - then option to get to the correct .m and .h files reappeared.
I faced a similar issue and here's what I did
I had a swift file and a xib file with its class connected to the swift file like so inside a group folder, and it doesn't show that they're connected.
But when I take them off the folder the assistant works somehow, so I took them off the folder and made an outlet from a UILabel then put them back inside the folder then they're permenantly connected.
Quite Xcode and reopen it. This is solve my problem.
I had the same problem. But my problem was about having the VC's under "View Controller" folder. When I move VC's to main folder instead of "View Controller" folder, I was able to reach the assistant without problem. If you have the same issue like mine, you can solve by deleting all the VC's and create again under your sub folder.
Just add the Class on right side of your story board which you want to open in assistant

Resources