Loading storyboards from a frame

I am creating a library with Cocoapods and Swift 1.2. I have a storyboard that I have to upload to my library. Although, I always get the same error:

The application terminated due to the uncaught exception "NSInvalidArgumentException", reason: "Could not find a storyboard with the name" Main "in the set."

What I tried:

  • place my storyboard inside the Classes folder
  • place my storyboard inside the Assets folder
  • Remove my application from the device, clean the project and rebuild it.
  • Use UIStoryboard(name:"Main", bundle:nil)
  • Use UIStoryboard(name:"Main", bundle:NSBundle(forClass:self))
  • Use UIStoryboard(name:"Main", identifier:myIdentifier)

Although I was able to download the storyboard from my sample project, I installed it, then I could only create an instance of the original view controller.

Trying to call storyboard!.instantiateViewControllerWithIdentifier(someIdentifier) from the original view controller always led to the view controller not being found, although I can clearly see that there is a view controller with this identifier. How can I fix this problem?

+5
source share
1 answer

Found a problem. Just silly, but after removing Main.storyboard from the project, I did not delete it from the project settings. Trying to load it as the initial controller. After changing the settings, UIStoryboard(name:"Main", bundle:NSBundle(forClass:self) works correctly.

+2
source

All Articles