iGameCenter library provides access to Apple's Game Center services. Currently only the leaderboard (high scores) feature is implemented.
This service requires some configuration:
1. You must use an explicit app id (without wildcards).
2. Must use a development certificate and provision profile during development.
3. Add this line:
4. An app record must be available in iTunes Connect.
5. Create a leaderboard:
6. Enable Game Center in the app version page:
The code itself is quite simple. You should initialize the GKGameCenter object when the program starts.
The AuthenticationStateChanged event will be raised.
If ShouldShowDialog is True then you need to call Game.ShowDialog.
The AuthenticationStateChanged can be raised in other cases as well so assume that it will be raised and the state will change.
Once authenticated you can submit the current user scores and you can get the top scores.
See the attached example (make sure to change the board id as needed).
See code in post #8 for showing the built-in leaderboard dialog.
Update:
Need to add to main module:
This service requires some configuration:
1. You must use an explicit app id (without wildcards).
2. Must use a development certificate and provision profile during development.
3. Add this line:
B4X:
#DeviceCapabilities: gamekit
5. Create a leaderboard:
6. Enable Game Center in the app version page:
The code itself is quite simple. You should initialize the GKGameCenter object when the program starts.
The AuthenticationStateChanged event will be raised.
If ShouldShowDialog is True then you need to call Game.ShowDialog.
The AuthenticationStateChanged can be raised in other cases as well so assume that it will be raised and the state will change.
Once authenticated you can submit the current user scores and you can get the top scores.
See the attached example (make sure to change the board id as needed).
See code in post #8 for showing the built-in leaderboard dialog.
Update:
Need to add to main module:
B4X:
#Entitlement: <key>com.apple.developer.game-center</key><true/>
Attachments
Last edited: