November 2011
Beginner
238 pages
6h 19m
English
The last step that we need to take when working with multiplayer support is to add in logic to handle disconnections and other failures that are unrecoverable. Luckily for us, Apple's APIs handle most of the legwork. We do, however, want to add a more universal call to our GameCenterManager class to make things easier for us.
- (void)disconnect;
{
if ([self.matchOrSession isKindOfClass: [GKSession class]])
{
[self.matchOrSession disconnectFromAllPeers];
}
else if ([self.matchOrSession isKindOfClass: [GKMatch class]])
{
[self.matchOrSession disconnect]; }
}
This method should be called whenever you wish to end a multiplayer game. It ...