How to Handle Match Start


The tournamentWillBegin method will be called when a player begins a Skillz match and should be used to launch your game. The tournamentWillBegin method gets called with two parameters.

NSDictionary gameParameters is a dictionary that is passed into this method by the Skillz framework, and contains the Game Parameters configured for the tournament the player is about to start. You can use these Game Parameters to configure different types of games for different tournaments.

SKZMatchInfo matchInfo is a data structure that contains information about the current match and the player in it. The data contained within can be used to display information to players or to power external analytics. You can use the IsSynchronous boolean in the SkillzSDK.Match object to determine whether the match is synchronous or asynchronous. (You can also fetch this object directly from the Skillz API by calling GetMatchInfo)

- (void)tournamentWillBegin:(SKZMatchInfo *)matchInfo
            withTournamentParameters:(NSDictionary *)params
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
    SZTSyncTestViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SZTSyncTestViewController"];
    [vc setMatchInfo:matchInfo];
    [vc setMatchRules:params];
    [self addChildViewController:vc];
    [self.view insertSubview:vc.view belowSubview:self.splashScreen];
    self.syncVC = vc;
    [vc.view setFrame:self.view.frame];

skillzWillExit (optional)

The skillzWillExit method is called when the Skillz portal is exited; it should be used to load the menu state of your game. 

- (void)skillzWillExit
    // This code is called when exiting the Skillz portal //back to the normal game.
    NSLog(@"Skillz exited.");

Next Step: Send and Receive Data