- Apple Developers Account
- Setup GameCenter Leaderboards with iTunesConnect
Setting up GameCenter Leaderboards:
- Sign in to iTunesConnect
- Go to My Apps. Create an app for your project then go to Features.
- Click on Game Center
- Click the plus sign next to Leaderboards.
- Choose Single Leaderboard for Leaderboard types.
- Create a Leaderboard Reference Name for your reference.
- Create a Leaderboard ID for your app to refer to when reporting scores.
- Set score format to Integer
- Score Submission will be Best Score
- Click Add language and fill the entries.
LeaderboardID that you made and lets head over to Xcode.
Working with Xcode
There are 4 functions that we will be working with.
Importing the framework and setting up the protocols
Checking if the user is signed in to GameCenter
Reporting the scores to GameCenter
Now we want to check if the user is signed in to GameCenter
- Now the user is using the app and suddenly the user has a new high score, we report the high score by calling the function below.
The function below hols 2 parameters.
Identifier which is defined as a string and used to enter your leaderboardID that you made in iTunesConnect.
score which is defined as an Int which will be the users score to submit to iTunesConnect
- Now if the user wants to view leaderboards, call the function below
This modified text is an extract of the original Stack Overflow Documentation created by following contributors
and released under CC BY-SA 3.0