Upgrade to Skillz SDK 8.0

If you are upgrading your Objective-C game from a version of Skillz prior to 8.0, you will need to make some changes to your game's integration.

This is due to Skillz switching from a callback-based API to a delegate-based API. This SkillzDelegate will need to be implemented in your project and will replace the callbacks in the following call: launchSkillzForOrientation:launchHasCompleted:tournamentWillBegin:skillzWillExit:.

For instance:

[[Skillz skillzInstance] launchSkillzForOrientation:SkillzPortrait
                                 launchHasCompleted:^(void) {
                                     NSLog(@"Skillz finished launching");
                                 }
                                tournamentWillBegin:^(NSDictionary *matchRules) {
                                    NSLog(@"Tournament is starting");
                                }
                                     skillzWillExit:^(void) {
                                         NSLog(@"Skillz finished launching");
                                     }];

 

will become:

// put the following in your implementation of SkillzDelegate

- (SkillzOrientation)preferredSkillzInterfaceOrientation
{
    return SkillzPortrait;
}

- (void)skillzHasFinishedLaunching
{
	NSLog(@"Skillz finished launching");
}

- (void)tournamentWillBegin:(NSDictionary *)gameParameters
{
	NSLog(@"Tournament is starting");
}

- (void)skillzWillExit
{
	NSLog(@"Skillz finished launching");
}

The callback and other parameters should be placed in the SkillzDelegate implementation:

Note: in cases where a nil block is passed as a callback, the method can be left unimplemented in the delegate.

After the preceding callback blocks have been converted, you can then launch Skillz by calling:

[[Skillz skillzInstance] launchSkillz];

The init method for your game will also change from:

[[Skillz skillzInstance] skillzInitForGameId:@"777"
                                 environment:skillzEnv];

To:

[[Skillz skillzInstance] initWithGameId:@"777"
                            forDelegate:delegate
                        withEnvironment:skillzEnv];

The delegate variable is a stand in for the instance of your implementation of SkillzDelegate.

The one remaining change is eliminating andScoreExtras from the displayTournamentResultsWithScore:andScoreExtras:withCompletion method.

This is as simple as changing: 

[[Skillz skillzInstance] displayTournamentResultsWithScore:@(self.score)
                                            andScoreExtras:nil
                                            withCompletion:nil]; 

To:

[[Skillz skillzInstance] displayTournamentResultsWithScore:@(self.score)
                                            withCompletion:nil];