I'm working on an app, but when I switch from my first view to my second view (game level). The game breaks with:
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
and with the alert Threat 1: signal SIGABRT.
I don't know why, by my other views this code work but when I want to switch to this view it breaks down. My switching code is:
-(void)collision {
if (CGRectIntersectsRect(Redsquare.frame, Invisible.frame)) {
Level2 *switchtosecondlevelchapter1 = [[Level2 alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:switchtosecondlevelchapter1 animated:YES];
}
}
I hope you can help me, i'm new to this. Thanks in advanced!
Is your nib name for Level2 literally "Level2"... in that case you can provide nil to initWithNibName: But also add break points and NSLog to debug and see where it is last called... for example you're literal presentModalViewController: code might be fine.... but your CGRectIntersectsRect might be... off.... Is everything initialized/non-zero Look at these different factors and reply as comment