Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I got this problem in a modified version of GKRocket. When a peer disconnected the app returned to the front screen and then reloaded the view that initiated the session.</p> <p>You need to fix this by instantiating the class that creates your GKSession as early in the App as possible. The user must not navigate any further back at any time until they close the app. Then maintain a pointer to the session controller class throughout your navigation stack so that you can call for peer lists etc.</p> <p>These methods are from the first view controller after AppDelegate</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //We setup the GKSession at this stage so that we do not create duplicate sessions as //the user navigates to and from the game lobby controller finding and managing peers manager = [[SessionManager alloc] init]; manager.lobbyDelegate = nil; //There is no game lobby at this stage so we nil this. [manager setupSession]; // call the session manager's setup method to create the session. It will start //looking for peers right away, but we won't see that until we go to the game lobby } -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { //Pass a pointer to the session manager along the line of segues [[segue destinationViewController] setManager:self.manager]; } </code></pre> <p>This code is modified from GKRocket - check out that tutorial to see what methods like setupSession do.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload