I’m having a few problems integrating Greystripe adverts (documented here but not important). A way around my problem if to just present my gameView like this
iSlideAppDelegate *appDelegate = (iSlideAppDelegate *)[[UIApplication sharedApplication] delegate];
UIStoryboard *storyboard = self.storyboard;
Game3ViewController *gameView = (Game3ViewController *)[storyboard instantiateViewControllerWithIdentifier:@"mainGameController"];
[appDelegate.window addSubview:gameView.view];
This is basically just adding my gameView on top of the current view controller.
Now from this view I want to show another modal view like this
FullScreenSelfAdViewController *adView = [[FullScreenSelfAdViewController alloc] initWithNibName:@"FullScreenSelfAdViewController" bundle:nil];
[adView setDismissDelegate:self];
[self presentModalViewController:adView animated:YES];
The problem is, when this view is displayed, my gameView deallocates. Meaning when I call to dismiss the AdView it dealloc’s but stays on screen as the underlying gameView isn’t there any more.
Is there a better way to call these views? (I can’t call my gameView by presenting it as a modal view).
Or a way to keep the gameView from deallocating?
If I had to guess, you don’t have a strong variable retaining the class that gets dealloced. Whoever creates that class should have a strong ivar doing so. I had this exact same problem when I tried to create an object and use it without retaining it. Note that for UIAlerts, the system retains it when you call [alert show], leading to think you can do this with other view controllers (which you cannot!)
Good luck.