In my code I have this line, but I was wondering if there is way to check whether @”SomeController” exists before I use it with the “instantiateViewControllerWithIdentifier” method. If the identifier doesn’t exist then the app crashes.
It’s not a huge problem if there isn’t a good way to do it, I can just be a bit more careful not to fat finger the identifier names, but I was hoping I could handle it more gracefully.
UIViewController *newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SomeController"];
No, there is no check for this. However, you don’t need to. This method will return
nilif the identifier doesn’t exist, so just check for that with anNSAssert.EDIT Actually this is wrong!! That’s weird…the return value section of the documentation contradicts another portion…but still the answer is ultimately no (there is no method to check for the existence of an identifier)