-1

I am creating a pod with storyboard instance and I have problem when I try to launch my app, I need someone to fix this please, I have tried everything but still I have the same problem I got this error :

app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named '' in bundle NSBundle (loaded)' *** First throw call stack: (0x1a0d1d27c 0x19fef79f8 0x1cd7e3350 0x102ea1700 0x102eac088 0x102eac018 0x103090c74 0x103092c84 0x1cf08ee40 0x102eac1b0 0x102b1e414 0x102b1e610 0x1cd30fd40 0x1ab3a1f28 0x1ab341304 0x1cd3142ac 0x1ab3a1f28 0x1ab3a216c 0x1ab341304 0x1cd311b94 0x1cd7e39a4 0x1cd657150 0x1cd6575d0 0x1cd655c34 0x1ccf192dc 0x1ccf21874 0x1ccf18f60 0x1ccf19850 0x1ccf17b9c 0x1ccf17864 0x1ccf1c3a4 0x1ccf1d188 0x1ccf1c25c 0x1ccf20f5c 0x1cd654328 0x1cd250ba8 0x1a36989fc 0x1a36a240c 0x1a36a1c14 0x103090c74 0x103094840 0x1a36d3040 0x1a36d2cdc 0x1a36d3294 0x1a0caf018 0x1a0caef98 0x1a0cae880 0x1a0ca97bc 0x1a0ca90b0 0x1a2ea979c 0x1cd657978 0x102b20f50 0x1a076e8e0) libc++abi.dylib: terminating with uncaught exception of type NSException

my storyboard share methods My code :

public static var share: ChatKit = {
    let storyboard = UIStoryboard(name: "ChatKit", bundle: nil)
    return storyboard.instantiateViewController(withIdentifier: "ChatKit") as! ChatKit
}()
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Lioz Balki
  • 55
  • 5

2 Answers2

1

Since you are probably in a CocoaPod the storyboard will not be in the main bundle. This is due to the fact that the storyboard is added to the CocoaPod resource bundle (probably you can see this in your .podspec). Better pass this bundle instead of nil:

Bundle(for: SomeClass.self)

where SomeClass lives in your Pod.

This question might help you as well: How to load resource in cocoapods resource_bundle

dehlen
  • 7,325
  • 4
  • 43
  • 71
0

let bundle = Bundle(for: YourBundleName.self)

bundle.loadNibNamed(NibFileName, owner: self, options: nil)

siddhant
  • 39
  • 2