Prerequisites:

  1. Apple Developers Account
  2. Setup GameCenter Leaderboards with iTunesConnect

Setting up GameCenter Leaderboards:

  1. Sign in to iTunesConnect
  2. Go to My Apps. Create an app for your project then go to Features.
  3. Click on Game Center
  4. Click the plus sign next to Leaderboards.
  5. Choose Single Leaderboard for Leaderboard types.
  6. Create a Leaderboard Reference Name for your reference.
  7. Create a Leaderboard ID for your app to refer to when reporting scores.
  8. Set score format to Integer
  9. Score Submission will be Best Score
  10. Click Add language and fill the entries.

Copy your LeaderboardID that you made and lets head over to Xcode.

Working with Xcode

There are 4 functions that we will be working with.

  1. Importing the framework and setting up the protocols
  2. Checking if the user is signed in to GameCenter
  3. Reporting the scores to GameCenter