要运行示例项目,请克隆存储库,然后首先从 Example 目录运行 pod install
命令。
Put this in your AppDelegate.m
// If you already setup leaderboard in iTunesConnect -> pass the leaderboard's identifier
static NSString * LeaderboardIdentifier = @"My-Leaderboard";
[CommonGameCenter createLeaderboardIfNotExists:LeaderboardIdentifier attributes:nil];
// ... setup more leaderboars
[CommonGameCenter startAuthenticationWithCompletion:^(BOOL authenticated, NSError *error) {
// game center started either offline or online
}];
#import CommonGameCenter.h
// Obtain score from leaderboard (returns GKScore)
[CommonGameCenter obtainScoreForLeaderboard:@"My-Leaderboard"]
// Report score to leaderboard
[CommonGameCenter reportScore:100 forLeaderboard:@"My-Leaderboard"];
That's it!
Enjoy
Comming soon :-)
Requires iOS 7 and later
Written in ARC
CommonUtilsGame 可以通过 CocoaPods 安装。要安装它,只需将以下行添加到您的 Podfile。
pod "CommonUtilsGame"
Karen Lusinyan, [email protected]
CommonUtilsGame 在 MIT 许可证下可用。更多详情请参阅 LICENSE 文件。