API Index
Overview
Setup
Initialize
Achievements
Challenges
Leaderboards
Scores
Players
Real-Time Game
Turn-Based Game
 
Before you can add Leaderboards to your game, you must configure Leaderboards in iTunes Connect and the GameKit Plugin must be setup as well as initialized.
 
Leaderboards Commands
Show Leaderboards UI
Get Leaderboards
Get Leaderboard Sets
Get Default LeaderboardID
Request Set Default LeaderboardID
Get Leaderboard Image
 

Show Leaderboards UI
Comments: Show Game Center Leaderboards UI.

Function: show( (string) “gameCenterLeaderboardsUI”, (table) { leaderboardID= (string) “com.yourSite.yourGame.leaderboard” } )
Param Table Keys: (string) leaderboardID – A unique Game Center leaderboard identifier string you created for your game on iTunes Connect.
Callback Events: none

 

Get Leaderboards
Comments: Get Game Center Leaderboards.

Function: get( (string) “leaderboards”, (table) { listener= (function) onLeaderboardsCallback } )
Param Table Keys: (function) listener – A function to receive callback events.
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “leaderboardList” – Leaderboard list event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(number) leaderboardsCount – Number of leaderboard tables in the leaderboards array.
(array) leaderboards – Array of leaderboard tables.
Leaderboard Table Keys:
(string) title – A localized Game Center title for the leaderboard you created for your game on iTunes Connect.
(string) leaderboardID – A unique Game Center leaderboard identifier string you created for your game on iTunes Connect.
(string) groupIdentifier – A unique Game Center identifier string for the group the leaderboard is part of. If your game was configured to be part of a group in iTunes Connect, this property holds the identifier you assigned to the group.

 

Get Leaderboard Sets
Comments: Get Game Center Leaderboard Sets.

Function: get( (string) “leaderboardSets”, (table) { listener= (function) onLeaderboardsCallback } )
Param Table Keys: (function) listener – A function to receive callback events.
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “leaderboardSetList” – Leaderboard Set list event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(number) leaderboardSetsCount – Number of leaderboard set tables in the leaderboardSets array.
(array) leaderboardSets – Array of leaderboard set tables.
Leaderboard Set Table Keys:
(string) title – A localized Game Center title for the leaderboard you created for your game on iTunes Connect.
(string) leaderboardID – A unique Game Center leaderboard identifier string you created for your game on iTunes Connect.
(string) groupIdentifier – A unique Game Center identifier string for the group the leaderboard is part of. If your game was configured to be part of a group in iTunes Connect, this property holds the identifier you assigned to the group.

 

Get Default LeaderboardID
Comments: Get Game Center default leaderboardID.

Function: (function) get( (string) “defaultLeaderboardID”, (table) { listener= (function) onLeaderboardsCallback } )
Param Table Keys: (function) listener – A function to receive callback events.
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “defaultLeaderboardID” – Default leaderboardID event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(string) leaderboardID – A unique Game Center leaderboard identifier string you created for your game on iTunes Connect.

 

Request Set Default LeaderboardID
Comments: Set Game Center default leaderboardID.

Function: (function) request( (string) “setDefaultLeaderboardID”, (table) { listener= (function) onLeaderboardsCallback } )
Param Table Keys: (function) listener – A function to receive callback events.
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “success” – GameKit success event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(string) successDescription – GameKit success description string.

 

Get Leaderboard Image
Comments: Get Game Center leaderboard image.

Function: (function) get( (string) “leaderboardImage”, (table) { leaderboardID= (string) “com.yourSite.yourGame.leaderboard”, listener= (function) onLeaderboardsCallback } )
Param Table Keys:
(string) leaderboardID – A unique Game Center leaderboard identifier string you created for your game on iTunes Connect.
(function) listener – A function to receive callback events.
Callback Events:
Event Name: (string) “gameKitLibrary”
Event Type:
(string) “error” – GameKit error event.
(string) “leaderboardImage” – Leaderboard image event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(string) leaderboardID – A unique Game Center leaderboard identifier string you created for your game on iTunes Connect.
(display object) image – An image to display for the leaderboard.