Singleton Implementation of Game Center for iOS, for managing Leaderboards, achievements and multi player.
In the instructions below I assume you have an app already configured on the iOS Provisioning Portal and iTunes Connect:
- Include the files on your project
- Import GameCenterManager.h in your App Delegate and in all the classes you need to use Leaderboards or Achievements with
#import "GameCenterManager.h"
- Authenticate the user on your applicationDidFinishLaunching: or applicationDidFinishLaunchingWithOptions: method by calling
[[GameCenterManager sharedGameCenterManager] authenticateLocalUser];
Note: If no local user is authenticated, a Game Center login window will appear. 4. Modify your achievements and leaderboards accordingly on GameCenterConstants.h 5. Report an achievement by using:
[[GameCenterManager sharedGameCenterManager] submitAchievement:kAchievement_FlySwatter percentComplete:100.0f];6. To submit a score to a Leaderboard:
[[GameCenterManager sharedGameCenterManager] submitScore:self.totalBugs forLeaderboard:kLeaderboard_EatenBugs];
- Implement Multi-player
Added Game Center styled UI notifications, thanks to Benjamin Borowski for GKAchievementNotification