November 2011
Beginner
238 pages
6h 19m
English
When you resume a game on your next turn, assuming it is not the first turn of a match, you will need to first restore the game state to its current position. To do this, we begin by modifying our viewDidLoad method to get the current match data. We need to call loadMatchDataWithCompletionHandler on our match object. This returns the data that we sent to the next player in the previous method. We then convert the NSData back into a dictionary and then add it to our gameDictionary.
- (void)viewDidLoad
{
//Existing viewDidLoad code...
[self.match loadMatchDataWithCompletionHandler:^(NSData *matchData, NSError *error)
{
NSDictionary *myDict = [NSPropertyListSerialization propertyListFromData:match.matchData ...