UIStoryboard keeping old outdated references - ios

In my iPad app that uses a UIStoryboard I used to have UITabBarController with a couple tabs and icons. Since then I have refactored my app to not use the UITabBarController (deleting the view controller in the storyboard. However, when I run my app I get the following error:
Could not load the "3dicon26better.png" image referenced from a nib in the bundle with identifier "com.xxxxx.yyyyyyy"
The icon in question was used as the tab bar icon in the old UITabBarController. Apparently my storyboard is keeping references to old deleted view controllers. Is there any way to clear them out?

Don't have a great solution, but I was able to stop the error by using a process I found in another SO post (can't remember where I found it).
Open my Storyboard in textedit. Search for references to the image in question. Comment them out XML style.
This stopped the errors, but it bothers me that my Storyboard has so many extra dead references in it. :/

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.

Xcode with multiple projects Storyboard reference bundle not working

I'm having a difficult time trying to figuring out how to make a storyboard reference work with storyboard from other project. I'm trying to modularize my App, so I'm creating multiple projects inside Xcode workspace. The point is that at some times, one storyboard from project A may have a reference to a storyboard in project B... I thought that the reason for the 'BUNDLE' option in a storyboard reference is that you could achieve what I've mentioned... I've attached an image that explain better what I'm saying... When I try to run, the app links to the Main.storyboard from Project A instead Main.storyboard from Project B...
I've checked and rechecked to make sure that bundle name is correct...
Thanks a lot, guys.
First give an id to the reference screen.
second write the storyboard referans add Reference id
The bundle name in the StoryBoard reference is the bundle identifier of the FrameWork/Project that contain your reference story board. For example: com.chozinul.CustomUI
Use storyboard name and push controller will viewcontroller identifiers

uiview deleted from storyboard is still showing

I have a very strange behavior in my ios app, if I go to the storyboard and delete the UIImageView object and then run the simulator it still show the image.
Any ideas?
I know why you don´t believe me, I didn´t beleive it either when I saw it, but I just found what(not why) was hapening: the problem was that I messed with the main storyboard configured in the project->info, somehow it was calling the old storyboard and i say somehow because there was no file with that name, it was not enough to change the property to the actual storyboard file, I needed to create a new one.

App crashes in AppDelegate and cannot get past launch screen

The app crashes in AppDelegate, unable to get beyond the launch screen. No view controller code ever gets executed.
The stack trace is also not very helpful nor is the line highlighted in AppDelegate when the crash occurs.
Images below provide the details.
How to debug from here?
Check any IBOutlet links carefully; you may have deleted the property from your view controller but the UI element is still connected to it. This should give you an exception stating something like Class ViewController is not key value coding-compliant for key XXX where XXX is your bad IBOutlet, however Swift's exception reporting does seem to be a bit hit-and-miss at times.
Here's another possible cause related to the reason Paulw11 stated that may help someone else.
If you have segue's in your storyboard that links to a storyboard reference in another bundle, and you change the name of the bundle where the reference resides, make sure to update the Bundle name in your storyboard for the linked reference.
I have a framework I'm developing that contains some storyboards and UI components. I decided to rename the framework, updated the podfile references in the app and all the file imports to reflect the new framework name but completely forgot that there were storyboard references in the app referencing view controllers provided in storyboards in the framework.
Here's an example:
If you do not rename the reference you will experience a crash when you try to load the storyboard containing your link with no hint as to why. I spent an embarrassing amount of time hunting this down.

STORYBOARD EXCEPTION - Storyboard doesn't contain a view controller with identifier

I am currently developing an iOS application for both iPhone and iPad. I'm trying to show a NavigationController to make a module that shows files. In an iPhone it works just fine, but I can´t get it to work in iPad.
I'm getting the following error:
'Storyboard (<UIStoryboard: 0x919b200>) doesn't contain a view controller with identifier 'FilesNavigation''
and this is the code:
case 10: // Files
{
UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:#"FilesNavigation"];
FilesViewController *filesViewController = [storyboard instantiateViewControllerWithIdentifier:#"Files"];
[navigationController pushViewController:filesViewController animated:YES];
self.slidingViewController.topViewController = navigationController;
break;
}
And in my storyboard I have already set the Storyboard ID for the navigation controller.
>##Custom Class
>Class: UINavigationController
>##Identity
>Storyboard ID: FilesNavigation
I used this code for another case on the switch/case block for other module and it works for iPad too, its the first time that I have this error.
I figured it out, the problem was that the Storyboard wasn't updating in the device.
Uninstall the app from the simulator/iPhone/iPad
Product > Clean
Build & Run
As stated in #T0m_Twt's answer in this question
In the right pane, in the identity inspector section give a storyboard Id to your Navigation Controller.
I took a screenshot for you
Here's another case:
There are two localized storyboards. Only one of them has the view controller you want.
By chance, do you have a storyboard for iPhone and a different one for iPad? If you do, then the iPad one might not have a storyboard with that identifier. Also when running on an iPad, set a break point in your code and verify what your "storyboard" object is.
I use a category on UIStoryboard that will give me the storyboards for each platform.
I can use [UIStoryboard storyboardHome] and that will determine if it needs iPad or iPhone specific and return that to me. I also ensure my storyboards follow proper naming. So I would have Home_iPad and Home_iPhone.
TL;DR - clear everything and remove old version of the app as well, if there's any.
It may sound crazy, but suppose that if you have changed target name which changed bundle name as well, you might have both the old and new version of the app installed in the simulator / device, and this might cause trouble for the UIStoryboard instance failed to instantiate some view controllers, which might eventually cause the trouble described in the question. To solve it, you need to remove all related apps or simply reset the simulator / device.

Resources