Reputation: 957
This is a very odd problem.
I include the .h file of the next view:
#import "MainGame.h"
The I have this code to switch rooms when I press the screen:
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
MainGame *newview = [[MainGame alloc] initWithNibName:@"MainGame" bundle:nil];
newview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:newview animated:YES completion:NULL];
}
And it works fine in the iOS 5 simulator; but when I test it on my iPod running iOS 4.2 it always just crashes.
All my IBOutlets are connected correctly and everything, as I've already said it works fine in the simulator but not on my iPod.
I have had each individual view working on my iPod before, so I am not using any features which require iOS 5 or anything; it's just this code that switches views that is not working.
Am I missing something?
Thanks!
Upvotes: 0
Views: 86
Reputation: 5900
I believe its a version issue
[self presentViewController:newview animated:YES completion:NULL];
doesn't exist in iOS 4.2 but does in iOS 5
try this instead
[self presentModalViewController:newview animated:YES];
Upvotes: 1
Reputation: 1840
According to the Apple documentation, presentViewController is iOS 5.0 and above.
Upvotes: 1