when I start my game from the main menu for the first time everything works fine. But after I go back to the menu and try to start the game again I get an exec_bad_access error that says something about dyld_stub_arc4random
the exec_bad_access is occuring in this method
Code:
-(void)menutonewgame{
thegameViewController *gameview = [[thegameViewController alloc] initWithNibName:@"thegame" bundle:nil];
[self setGameViewController:gameview];
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:NO];
[viewController.view removeFromSuperview];
[self.window addSubview:[gameViewController view]]; //ERROR OCCURS HERE
[UIView commitAnimations];
[gameview release];
}
and the only place i use arc4random is inside thegameViewController in this 1 method
Code:
int getnext(){
int i;
do{
i = arc4random() % 100;
}while(level[i]==0 || level[i]==(int)NULL);
int next = level[i];
return next;
}
any help would be greatly appreciated. thanks.