0
이것은 gamecenter를 포함한 내 첫 번째 앱이며, 약간의 문제가 있습니다. 내가 그물에서 작동하는 몇 가지 코드를 구현했습니다. 난에 "가까운 리더"를 얻을하지는 - 모든 것이 완료 버튼을 누르면라는 "완료 버튼":(xcode "완료 버튼"GameCenter does do t'll do
하는 .m
#import <GameKit/GameKit.h>
- (void)viewDidLoad {
[[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) {
if (error == nil)
NSLog(@"Authentication Successful!");
else
NSLog(@"Authentication Failed!");
}];
-(IBAction)subscore{
GKScore *scoreReporter = [[GKScore alloc] initWithCategory:@"lrhseasy"];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil) {
NSLog(@"Submitting a score failed!");
}
else {
NSLog(@"Submitting succeeded!");
}
}];
}
-(IBAction)showLeader{
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc]init];
if (leaderboardController != nil) {
//leaderboardController.leaderboardDelegate = self;
[self presentModalViewController:leaderboardController animated:YES];
}
}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController {
NSLog(@"Close leaderboard");
[self dismissModalViewControllerAnimated:YES];
[viewController.view.superview removeFromSuperview];
}
마지막 기능의 밤은,를 제외하고 잘 작동 디버그 콘솔.
3 시간 동안 검색 한 후, 내가 찾은 유일한 는 "는이 클래스는? 구현하는 프로토콜 목록에 GKLeaderboardViewControllerDelegate를 추가나요"하지만 난 모르는 것은이 무엇을 의미하는지이었다 또는 방법의를 완료 :(