我做了一个自定义框架,并通过本教程捆绑了资源。
捆绑包资源中有一个故事板(内部有一个ViewController)和一个图像。
ViewController
如果连接了IBOutlet
或,则显示当前的崩溃IBAction
。我确定UI
对象的每个连接都很好。
我尝试使用xib,并且效果很好。
这里是错误日志:
*由于未捕获的异常'NSUnknownKeyException'而终止应用程序,原因:'[setValue:forUndefinedKey:]:此类与密钥goButton的键值编码不兼容。*第一掷调用堆栈:(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:端接带有NSException类型的未捕获异常
错误前有一个警告:
接口生成器文件中的未知类TestViewController。
这是我从捆绑资源的面板中看到的viewcontroller的代码。
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];
关于警告,您得到了:
接口生成器文件中的未知类TestViewController。
有两种可能性:
TestViewController.h
和TestViewController.m
文件添加到项目中。但是以某种方式,您的文件可能会从Finder中被删除。现在,如果您发现要面对第二种情况,请转到“废纸rash”,选择文件,右键单击并选择“放回”。
然后转到您的xCode项目,右键单击您的项目名称,然后选择将文件添加到“您的项目名称”。
希望这能解决您的问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句