I do a custom framework and bundle resources by this tutorial.
There are a storyboard (a ViewController inside) and an image in the bundle resources.
I present the ViewController
then crash, if I connected any IBOutlet
or IBAction
.
I am sure every connection of UI
object is fine.
I have tried to use xib and it worked perfectly.
Here the error log:
* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key goButton.' * First throw call stack: (0x244a391b 0x23c3ee17 0x244a3629 0x24c171f3 0x28d828b7 0x24c296d3 0x28ed3e9b 0x243ed1cb 0x28ed2bd1 0x28d85aa3 0x28b58ffb 0x28a1ea1f 0x28a1e971 0x292b3ec1 0x28d6ad01 0x28d8e6e5 0x28d90d25 0x28d90f91 0x28b17db9 0xd0b5 0x28a3714b 0x28aa7193 0x28aa7129 0x28cc75b1 0x28cd37db 0x24465d21 0x244657dd 0x24463d51 0x243b3229 0x243b3015 0x259a3ac9 0x28a87189 0xd2ed 0x2405b873) libc++abi.dylib: terminating with uncaught exception of type NSException
There is a warning before the error:
Unknown class TestViewController in Interface Builder file.
Here is the code I present viewcontroller from a stroyboard of bundle resources.
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"XXXSDK" ofType:@"bundle"];
NSBundle *resourcesBundle = [NSBundle bundleWithPath:bundlePath];
UIStoryboard *resourcesStoryboard = [UIStoryboard storyboardWithName:@"Resources" bundle:resourcesBundle];
TestViewController *testVC = [resourcesStoryboard instantiateViewControllerWithIdentifier:@"TestViewController"];
[self presentViewController:testVC animated:YES completion:nil];