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

Show Achievements UI
Comments: Show Game Center Achievements UI.

Function: show( (string) “gameCenterAchievementsUI” )
Param Table Keys: none
Callback Events: none

 

Request Reset Achievements
Comments: Request Reset all local player’s Apple Game Center Achievements.

Function: request( (string) “resetAchievements”, (table) { listener= (function) onCallback } )
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.

 

Send Achievement Progress
Comments: Send Game Center local player’s Achievement progress.

Function: (function) send( (string) “achievementProgress”, (table) { achievementID= (string) “com.yourSite.yourGame.achievement_wow”, percentComplete= (number) 100.0, showsCompletionBanner= (boolean) true, listener= (function) onCallback } )
Param Table Keys:
(string) achievementID – A unique Game Center achievement identifier string you created for your game on iTunes Connect.
(number) percentComplete – A percentage decimal number value between 0.0 and 100.0 of how far the local player has progressed on this achievement.
(boolean) showsCompletionBanner – A boolean value that states whether a notification banner is displayed when the achievement is completed.
(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 Achievement Progress
Comments: Get local player’s Game Center Achievement progress.

Function: (function) get( (string) “achievementProgress”, (table) { listener= (function) onCallback } )
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) “achievementProgress” – Achievement progress event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(number) achievementsCount – Number of achievement tables in the achievements array.
(array) achievements – Array of achievement tables.
Achievement Table Keys:
(string) playerID – A string assigned by Game Center to uniquely identify a player.
(string) achievementID – A unique Game Center achievement identifier string you created for your game on iTunes Connect.
(boolean) isCompleted – A boolean value that states whether the local player has completed the achievement.
(number) percentComplete – A percentage decimal number value between 0.0 and 100.0 of how far the local player has progressed on this achievement.
(boolean) showsCompletionBanner – A boolean value that states whether a notification banner is displayed when the achievement is completed.
(string) lastReportedDate – The last time that progress on the achievement was successfully reported to Game Center.

 

Get Achievement Descriptions
Comments: Get Game Center Achievement descriptions.

Function: (function) get( (string) “achievementDescriptions”, (table) { listener= (function) onCallback } )
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) “achievementDescriptions” – Achievement descriptions event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(number) descriptionsCount – Number of description tables in the descriptions array.
(array) descriptions – Array of description tables.
Description Table Keys:
(string) title – A localized title for the achievement.
(string) achievementID – A unique Game Center achievement identifier string you created for your game on iTunes Connect.
(string) groupIdentifier – The identifier for the game group in iTunes Connect the achievement description is part of.
(string) unachievedDescription – A localized description of the achievement to be used when the local player has not completed the achievement.
(string) achievedDescription – A localized description to be used after the local player has completed the achievement.
(number) maximumPoints – The number of points the local player earns by completing this achievement.
(boolean) isHidden – A boolean value that states whether this achievement is initially visible to players.
(boolean) isReplayable – A Boolean value that states whether this achievement can be earned multiple times.

 

Get Achievement Image
Comments: Get Game Center Achievement image.

Function: (function) get( (string) “achievementImage”, (table) { achievementID= (string) “com.yourSite.yourGame.achievement_wow”, listener= (function) onCallback } )
Param Table Keys:
(string) achievementID – A unique Game Center achievement 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) “achievementImage” – Achievement image event.
Event Properties:
(number) errorCode – GameKit GKErrorCode number.
(string) errorDescription – GameKit error description string.
(string) achievementID – A unique Game Center achievement identifier string you created for your game on iTunes Connect.
(display object) image – An image to display for the completed achievement.