Skip initial view controller if it doesn't exist

This commit is contained in:
root 2025-05-12 19:04:11 -04:00
parent 43feefce68
commit 7850f8e61b
2 changed files with 77 additions and 58 deletions

View file

@ -612,10 +612,14 @@
if ([docNodes count] > 0)
{
NSXMLElement *docNode = [docNodes objectAtIndex: 0];
if (docNode != nil)
{
NSArray *array = [docNode nodesForXPath: @"//scene" error: NULL];
NSArray *firstResponderIdNodes = [docNode nodesForXPath: @"//objects/customObject[@sceneMemberID =\"firstResponder\"]/@id"
error: NULL];
NSString *firstResponderId = @"-1";
NSXMLNode *initialViewControllerNode = [docNode attributeForName: @"initialViewController"];
if([firstResponderIdNodes count] > 0)
{
@ -623,7 +627,11 @@
}
// Set initial view controller...
if (initialViewControllerNode != nil)
{
ASSIGN(_initialViewControllerId, [[docNode attributeForName: @"initialViewController"] stringValue]);
}
FOR_IN(NSXMLElement*, e, array)
{
NSXMLElement *doc = [[NSXMLElement alloc] initWithName: @"document"];
@ -675,6 +683,12 @@
[NSException raise: NSInternalInconsistencyException
format: @"No document element found in storyboard file"];
}
}
else
{
[NSException raise: NSInternalInconsistencyException
format: @"Document node returned nil"];
}
}
- (BOOL) isProcessedDocument: (NSXMLDocument *)xmlIn

View file

@ -164,8 +164,13 @@ static NSStoryboard *__mainStoryboard = nil;
- (id) instantiateControllerWithIdentifier: (NSStoryboardSceneIdentifier)identifier
{
if (identifier != nil)
{
return [self instantiateControllerWithIdentifier: identifier
creator: nil];
}
return nil;
}
- (id) instantiateControllerWithIdentifier: (NSStoryboardSceneIdentifier)identifier