jeudi 26 février 2015

UISplitViewController "ViewIdentifier was not found in Storyboard" error with iOS 7

I'm dealing with an odd error around an UISplitViewController


I created a library in order to deal with ViewControllers presentation and reuse code as much as possible. Within this code I instantiate ViewControllers using their storyboard IDs and I'm using to switch a ViewController with a SplitViewController.


Despite it works fine in iOS 8, it crashes in iOS 7 with this error.



Storyboard (<UIStoryboard: 0x7f94bb52ccd0>) doesn't contain a view controller with identifier 'MySplitViewControllerIdentifier'


The code where this happens is this



+(UIViewController *) instantiateStoryboard:(UIStoryboard *) storyboard
withViewIdentifier:(NSString *) identifier
{
@try {
if ([identifier isEqualToString:@""] || identifier == nil) {
return [storyboard instantiateInitialViewController];
}
else {
//HERE IT CRASHES !!!!!!
return [storyboard instantiateViewControllerWithIdentifier:identifier];
}
}
@catch (NSException *exception) {
NSLog(ERROR_NO_VIEWCONTROLLER_FOUND, [self class], identifier, storyboard.description);
}
}


I checked several times the config of this SplitViewController on my storyboard and the Storyboard ID is correct. If it helps, this SplitViewController is not subclassed.


Someone dealt with something similar?


Thanks




Aucun commentaire:

Enregistrer un commentaire