I'm creating a library with Cocoapods and Swift 1.2. I have a storyboard that I have to load in my library. Although, I am always getting this same error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle`.
What I have tried:
Classes
folderAssets
folderUIStoryboard(name:"Main", bundle:nil)
UIStoryboard(name:"Main", bundle:NSBundle(forClass:self))
UIStoryboard(name:"Main", identifier:myIdentifier)
I was although able to load the storyboard from my example project, put then I was only able to instantiate the initial view controller.
Trying to invoke storyboard!.instantiateViewControllerWithIdentifier(someIdentifier)
from the initial view controller always resulted in the view controller not being found, although I can clearly see that there is a view controller with that identifier. How can I fix this issue?
Select the View Controller in the storyboard and press Command + C to copy. Then press Command + V to paste in the second storyboard.
There are two ways to add the project to your app: Drag the framework into the project navigator, and then add the framework to the target. Add the framework to the project, and then add the framework to the target.
Found the problem. Just silly but after deleting the Main.storyboard from the project, I didn't remove it from the project's settings. Trying to load it as the initial view controller. After changing the settings, UIStoryboard(name:"Main", bundle:NSBundle(forClass:self)
just works properly.
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