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
folder Assets
folder UIStoryboard(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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.