简体   繁体   中英

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 )

This view controller has a button in it and I show a UIAlertView upon a tap on this button. Simple? Here is my issue:

I get:

Unknown class MyCustomClass in Interface Builder file.

When I push the view controller to the 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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