简体   繁体   English

从Storyboard加载UIViewController时,类类型不正确

[英]Incorrect Class type when loading a UIViewController from Storyboard

I have a UIViewController in my storyboard for which I have set my own custom class MyCustomClass (that extends UIViewController ) 我的情节UIViewController中有一个UIViewController ,为此我设置了自己的自定义类MyCustomClass (扩展了UIViewController

This view controller has a button in it and I show a UIAlertView upon a tap on this button. 该视图控制器中有一个按钮,点击此按钮会显示一个UIAlertView Simple? 简单? Here is my issue: 这是我的问题:

I get: 我得到:

Unknown class MyCustomClass in Interface Builder file.

When I push the view controller to the UINavigationController : 当我将视图控制器推到UINavigationController

MyCustomClass *vc = [story instantiateViewControllerWithIdentifier:@"MyCustomClassView"];
NSLog(@"receiver's type: %@", NSStringFromClass([vc class]));

Which causes the app to crash when I tap the button inside this view controller. 当我点击该视图控制器内的按钮时,这会导致应用程序崩溃。 Any reason why that might be happening? 有什么原因可能会发生这种情况?

Turns out my squids target was missing the header files. 原来我的鱿鱼目标缺少头文件。 Not sure why. 不知道为什么。 I created a clone of the main build target and it adds properly for that. 我创建了主要构建目标的克隆,并为此添加了适当的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM