I have the following code:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MyViewController" bundle:nil];
UINavigationController *navControllerInstance = [storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([MyViewController class])];
When I use targets my problem is [MyViewController class]
is returning "MyTarget_2.MyViewController"
then my app crash because "'Storyboard (<UIStoryboard: 0x600001e65d80>) doesn't contain a view controller with identifier "
I have two targets: MyTarget and MyTarget_2 and is only failing with the last one.
I don't understand is why [MyViewController class] is returning MyTarget.MyViewController. When I start a new project this is not happening, only returns MyViewController . Why is such a difference?
This seems to be related because I'm using swift+objective-c Calling NSStringFromClass on a Swift Class in Objective-C returns module mangled name
You can get class name like this :
and make sure that your storyboard id should be
MyViewController