nihalahmed / gamecentermanager Goto Github PK
View Code? Open in Web Editor NEWiOS Game Center helper singleton
License: Other
iOS Game Center helper singleton
License: Other
Any plans to create a Swift version of this great app?
Scores are never saved.
Critical and very serious bug.
Issue:
In - (void)saveAndReportScore:(int)score leaderboard:(NSString *)identifier sortOrder:(GameCenterSortOrder)order {
if ([self checkGameCenterAvailability:NO] == YES) {
// ... EDITED OUT
#if TARGET_OS_IPHONE
GKScore *gkScore = [[GKScore alloc] initWithLeaderboardIdentifier:identifier];
#else
#ifdef __MAC_10_10
GKScore *gkScore = [[GKScore alloc] initWithLeaderboardIdentifier:identifier];
#else
GKScore *gkScore = [[GKScore alloc] initWithCategory:identifier];
#endif
#endif
// <<--------------- SCORE is never set for gkScore
[self saveScoreToReportLater:gkScore];
}
Fix: Add [gkScore setValue:score];
above [self saveScoreToReportLater:gkScore];
I first try to call
[[GameCenterManager sharedManager] setupManager];
[[GameCenterManager sharedManager] setDelegate:self];
when the app launches. However, the result comes from [self checkGameCenterAvailability]
is not correct. Because of the asyn call in localPlayer.authenticateHandler
.
I think this will make following code in init method not really useful. Because if GameCenterManager is init when app starts, gameCenterAvailable will always be NO. The essential syncGameCenter
call is not called.
if (gameCenterAvailable) {
// Set GameCenter as available
[self setIsGameCenterAvailable:YES];
if (![[NSUserDefaults standardUserDefaults] boolForKey:[@"scoresSynced" stringByAppendingString:[self localPlayerId]]]
|| ![[NSUserDefaults standardUserDefaults] boolForKey:[@"achievementsSynced" stringByAppendingString:[self localPlayerId]]])
[self syncGameCenter];
else
[self reportSavedScoresAndAchievements];
}
I've put a temporary fix as following, everything works fine.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[GameCenterManager sharedManager] setupManager];
[[GameCenterManager sharedManager] setDelegate:self];
});
I think checkGameCenterAvailability might be refactor to use completionHandler ?
I have implemented correctly GameCenter, Achievement is really sended and i can see % of it, when i get 100% i need to swho Banner (Bool is set to YES) but nothing appear ?
cocos2d using openGL but d'ont understand why the banner is not displayed ;(
other way is to introduce a delegate method to display custom banner, the method retreive data about the achievement (desc, title etc...)
Okay huge bug!
In OSX the plist for the Game Center Manger is currently saved here:
/Users/username/Library/GameCenterManager.plist
As you can imagine... this is a huge issue!!! If any other OSX Game uses GameCenterManager... goodbye save games.
I'm working on a solution that keeps the current locations for iOS and changes to Application Support for OSX (as specified as the appropriate location by Apple)
I am new to cocos2D, I just don't know how to show leaderboard in my code because I just used some ccb files as scenes. There is no viewControllers in my code. Any help will be great appreciated!
Hello,
I'm trying to integrate GCM into the Mac version of my project (I already have Game Center in the iOS version of my game).
Following the instructions very closely, after I've added the two lines, the second one (initgamecenter) throws the error in the title. Any idea? I can't seem to get it to recognize the methods in the GameCenterManager file (the setDelegate line, however, works fine).
[[GameCenterManager sharedManager] setDelegate:self];
[[GameCenterManager sharedManager] initGameCenter];
Thanks,
The problem could be that the header file was imported into file.mm file (objective-c++), which is not supported to the @import module syntax.
The following error is triggered when importing the GameCenterManger from an Objective-C++ file (.mm)
import "GameCenterManager.h"
GCManager/GameCenterManager.h:36:1: Use of '@import' when modules are disabled
Just to clarify: CLANG_ENABLE_MODULES = YES
Doesn't matter with Objective-C++... does not work.
I started using your code, great job, but when I try to display a leaderboard (in the released app), the view controller 'crashes' (I don't think it's a real crash, but the leaderboard view controller just disappears).
I opened the app w/ the console up and I get this error (below). It looks like a collection view error - not your code - but I wondered if you've seen it. Thanks!
Feb 26 21:02:17 Bear-iPhone com.apple.facebook.xpc[146] : 2014-02-26 21:02:17.880|com.apple.facebo|0x15d5ab70: New remote session: <FBDSession: 0x15d568c0>
Feb 26 21:02:18 Bear-iPhone GameCenterUIService[185] : *** Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit/UIKit-2903.23/UICollectionView.m:3564
Feb 26 21:02:18 Bear-iPhone GameCenterUIService[185] : *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to insert item 3 into section 0, but there are only 3 items in section 0 after the update'
*** First throw call stack:
(0x2eb5be83 0x38eb86c7 0x2eb5bd55 0x2f5040af 0x314a1b4b 0x3e999 0x2f6c3ee1 0x2f6c3ee1 0x2f77250d 0x3939d0c3 0x3939d0af 0x3939f9a9 0x2eb265b1 0x2eb24e7d 0x2ea8f471 0x2ea8f253 0x337c92eb 0x31344845 0x4924b 0x393b1ab7)
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : ReportCrash acting against PID 185
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Formulating crash report for process GameCenterUIService[185]
Feb 26 21:02:18 Bear-iPhone com.apple.launchd1 : (UIKitApplication:com.apple.gamecenter.GameCenterUIService[0x385b]) Job appears to have crashed: Abort trap: 6
Feb 26 21:02:18 Bear-iPhone backboardd[28] : Application 'UIKitApplication:com.apple.gamecenter.GameCenterUIService[0x385b]' exited abnormally with signal 6: Abort trap: 6
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Not saving crash log because we have reached the limit for logs to store on disk. Sync or otherwise clear logs from /var/mobile/Library/Logs/CrashReporter to save new logs.
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Could not save crash report to disk!
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Incident Identifier: E2B7E0A2-6AEE-4679-B191-6F6018EE4836
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : CrashReporter Key: 18fcecbb2d7ba6d23280a899de1433c696fe0bbb
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Hardware Model: iPhone5,1
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Process: GameCenterUIService [185]
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Path: /Applications/GameCenterUIService.app/GameCenterUIService
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Identifier: GameCenterUIService
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Version: ???
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Code Type: ARM (Native)
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Parent Process: launchd [1]
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Date/Time: 2014-02-26 21:02:18.401 -0600
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : OS Version: iOS 7.0.4 (11B554a)
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Report Version: 104
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Exception Type: EXC_CRASH (SIGABRT)
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Exception Codes: 0x0000000000000000, 0x0000000000000000
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Triggered by Thread: 0
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Last Exception Backtrace:
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : (0x2eb5be7e 0x38eb86c2 0x2eb5bd50 0x2f5040aa 0x314a1b46 0x3e994 0x2f6c3edc 0x2f6c3edc 0x2f772508 0x3939d0be 0x3939d0aa 0x3939f9a4 0x2eb265ac 0x2eb24e78 0x2ea8f46c 0x2ea8f24e 0x337c92e6 0x31344840 0x49246 0x393b1ab2)
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : Thread 0 Crashed:
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 0 libsystem_kernel.dylib 0x394681fc 0x39455000 + 78332
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 1 libsystem_pthread.dylib 0x394cfa4e 0x394cc000 + 14926
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 2 libsystem_c.dylib 0x39419028 0x393cf000 + 303144
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 3 libc++abi.dylib 0x3886798a 0x38867000 + 2442
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 4 libc++abi.dylib 0x388806e2 0x38867000 + 104162
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 5 libobjc.A.dylib 0x38eb8936 0x38eb0000 + 35126
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 6 libc++abi.dylib 0x3887e1b0 0x38867000 + 94640
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 7 libc++abi.dylib 0x3887da04 0x38867000 + 92676
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 8 libobjc.A.dylib 0x38eb8796 0x38eb0000 + 34710
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 9 CoreFoundation 0x2eb5bd50 0x2ea87000 + 871760
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 10 Foundation 0x2f5040aa 0x2f472000 + 598186
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 11 UIKit 0x314a1b46 0x312d5000 + 1887046
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 12 GameCenterUIService 0x0003e994 0x3b000 + 14740
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 13 GameCenterFoundation 0x2f6c3ede 0x2f6b4000 + 65246
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 14 GameCenterFoundation 0x2f6c3ede 0x2f6b4000 + 65246
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 15 GameCenterUI 0x2f772508 0x2f72f000 + 275720
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 16 libdispatch.dylib 0x3939d0c0 0x3939c000 + 4288
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 17 libdispatch.dylib 0x3939d0ac 0x3939c000 + 4268
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 18 libdispatch.dylib 0x3939f9a4 0x3939c000 + 14756
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 19 CoreFoundation 0x2eb265ac 0x2ea87000 + 652716
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 20 CoreFoundation 0x2eb24e78 0x2ea87000 + 646776
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 21 CoreFoundation 0x2ea8f46c 0x2ea87000 + 33900
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 22 CoreFoundation 0x2ea8f24e 0x2ea87000 + 33358
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 23 GraphicsServices 0x337c92e6 0x337c2000 + 29414
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 24 UIKit 0x31344840 0x312d5000 + 456768
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 25 GameCenterUIService 0x00049246 0x3b000 + 57926
Feb 26 21:02:18 Bear-iPhone ReportCrash[192] : 26 libdyld.dylib 0x393b1ab4 0x393b0000 + 6836
Hi
Thanks a lot for this lib. The call [[GameCenterManager sharedManager] highScoreForLeaderboard:@"LeaderboardID"] is very useful.
I am having a hard time trying to do the same thing but to retrieve the player rank (position in the leaderboard). Would it be easy for you to provide the highRankForLeaderboard method as well?
Thanks very much, have a nice day.
Will this be updated for Xcode 7 and iOS 9? Thanks! :)
I downloaded, and can build for iOS no problem. When building for OS X, I'm getting errors regarding UIViewController
not being defined.
I added to the headers on Mac side
#if !TARGET_OS_IPHONE
@compatibility_alias UIViewController NSViewController;
#endif
and also wrapped the methods that don't compile... however, still I don't get the Mac OS version to run
diff --git a/GC Manager/GameCenterManager.h b/GC Manager/GameCenterManager.h
index a2ecd467d56b05cef8f23593cf642f8fa6dea82d..9df27798229afb462f3ef4a2d95e689cbe756c66 100755
--- a/GC Manager/GameCenterManager.h
+++ b/GC Manager/GameCenterManager.h
@@ -38,8 +38,6 @@
#import "NSDataAES256.h"
-
-
/// Leaderboard sort order. Use this value when submitting new leaderboard scores. This value should match the value set in iTunes Connect for the speicifed leaderboard.
typedef enum GameCenterSortOrder {
/// Scores are sorted highest to lowest. Higher scores are on the top of the leaderboard
@@ -156,7 +154,7 @@ typedef NSInteger GCMErrorCode;
-
+#if TARGET_OS_IPHONE
/// Presents the GameCenter Achievements ViewController over the specified ViewController. Dismissal and delegation is handled by GameCenterManager.
- (void)presentAchievementsOnViewController:(UIViewController *)viewController;
@@ -165,7 +163,7 @@ typedef NSInteger GCMErrorCode;
/// Presents the GameCenter Challenges ViewController over the specified ViewController. Dismissal and delegation is handled by GameCenterManager.
- (void)presentChallengesOnViewController:(UIViewController *)viewController;
-
+#endif
diff --git a/GC Manager/GameCenterManager.m b/GC Manager/GameCenterManager.m
index df357268a5ddd75cd0efe0810a44927202d2149e..669310a39209d7635ad4963874c4f0edad80e34b 100755
--- a/GC Manager/GameCenterManager.m
+++ b/GC Manager/GameCenterManager.m
@@ -930,6 +930,8 @@
//------------------------------------------------------------------------------------------------------------//
#pragma mark - Presenting GameKit Controllers
+#if TARGET_OS_IPHONE
+
- (void)presentAchievementsOnViewController:(UIViewController *)viewController {
GKGameCenterViewController *achievementsViewController = [[GKGameCenterViewController alloc] init];
achievementsViewController.viewState = GKGameCenterViewControllerStateAchievements;
@@ -955,6 +957,8 @@
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
+#endif
+
//------------------------------------------------------------------------------------------------------------//
//------- Resetting Data -------------------------------------------------------------------------------------//
//------------------------------------------------------------------------------------------------------------//
Hi!
When I use
[[GameCenterManager sharedManager] saveAndReportScore:points leaderboard:leaderboard_points sortOrder:GameCenterSortOrderHighToLow];
my high score on the (live) Game Center leaderboard is always replaced with the latest (rather than highest) value...
Any thoughts?
Hi,
If the user cancel the login controller, every other time i call:
[[GameCenterManager sharedManager] presentLeaderboardsOnViewController:self];
It only show a alert view that say user is not signed in.
Is there a way to display the login again ?
It's on IOS.
Trying to sync achievements saved from offline play. Doesn't work as reportSavedScoresAndAchievements is not called in GameCenterManager's init method. This appears to happen because checkGameCenterAvailability always returns false on application startup (which makes sense, because GC hasn't had time to authenticate yet.
Relevant code:
if (self) {
BOOL gameCenterAvailable = [self checkGameCenterAvailability];
if (gameCenterAvailable) {
// Set GameCenter as available
[self setIsGameCenterAvailable:YES];
if (![[NSUserDefaults standardUserDefaults] boolForKey:[@"scoresSynced" stringByAppendingString:[self localPlayerId]]]
|| ![[NSUserDefaults standardUserDefaults] boolForKey:[@"achievementsSynced" stringByAppendingString:[self localPlayerId]]])
[self syncGameCenter];
else
[self reportSavedScoresAndAchievements];
} else
[self setIsGameCenterAvailable:NO];
}
Split the main GameCenterManager class into multiple classes for Achievement, Leaderboard, Challenge, Profile, and Multiplayer handling. Each of these classes will be routed through a main class titled Referee
.
It would be nice if we could retrieve from 1- 100 scores from each leaderboard, instead of just 1. Could this be done with the NSRange property?
I'm not quite sure how to integrate this with SpriteKit. I've been searching for answers but none turned up.
Thanks for this great library! Is it possible to present the login view controller programmatically? I tried using the delegate authenticate user function, but I couldn't figure out what would need to go in the last parameter. Thanks again!
I've added Gamecentermanager(h and m), NSDataAES256 (h and m) and researchability (h and m) to my project however when I want to call the function
[[GameCenterManager sharedManager] saveAndReportAchievement:@"name" percentComplete:percent];
It gives me an error saying ' No visible @interface for 'GameCenterManager' declares the selector 'saveAndReportAchievement:'
As I am new to programming in general and don't know much about objective C, could someone tell me how i'd go about linking the function in Gamecentermanager.m to my view controller?
Hi i create this function for request GKScore can you implement that ? it is swift if you want convert it tell me .
func requestLeaderboard(#leaderboardIdentifier:String,completion: ((result:GKScore?) -> Void)) {
if GameCenterManager.sharedManager().isGameCenterAvailable {
let leaderBoardRequest = GKLeaderboard()
leaderBoardRequest.identifier = leaderboardIdentifier
leaderBoardRequest.loadScoresWithCompletionHandler { (scores, error) ->
Void in
if error != nil {
println("Error: \(error!.localizedDescription)")
completion(result: nil)
} else if (scores != nil) {
completion(result: leaderBoardRequest.localPlayerScore)
}
}
}
}
2014-06-20 00:29:59.458 GameCenterManager[280:35714] GC Availabilty: {
message = "Player is not signed into GameCenter, has declined to sign into GameCenter, or GameKit had an issue validating this game / app.";
title = "Player not Authenticated";
}
2014-06-20 00:36:37.587 GameCenterManager[280:35714] unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow: <UIClassicWindow: 0x1566e8c0; frame = (0 0; 768 1024); userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x15589fe0>; layer = <UIWindowLayer: 0x15672d40>>
2014-06-20 00:36:37.986 GameCenterManager[280:35714] unexpected nil window in _UIApplicationHandleEventFromQueueEvent, _windowServerHitTestWindow: <UIClassicWindow: 0x1566e8c0; frame = (0 0; 768 1024); userInteractionEnabled = NO; gestureRecognizers = <NSArray: 0x15589fe0>; layer = <UIWindowLayer: 0x15672d40>>
2014-06-20 00:36:43.594 GameCenterManager[280:35714] GC Availabilty: {
message = "Player is not signed into GameCenter, has declined to sign into GameCenter, or GameKit had an issue validating this game / app.";
title = "Player not Authenticated";
}
Can't login on iPad iOS 8.0 beta 2. Works well on iphone.
Hello,
Taking a look at your GameCenterManager, I realized how awesome it was. The one main thing it's missing (in my opinion) is the ability to use CocoaPods. Is this something you would consider adding? It's a simple podspec file, and I would write it for you if you're interested. I think this would help expose this tool, as well as make it easier for users to implement in their own projects.
Thanks,
Matthew
I guess I will not be the last to ask for this. It seems that Apple made a few changes in the tvOS API. It would be great to have this library updated
Using Xcode 6.3.2 with deployment target of 8.2, whenever I call the resetAchievementsWithCompletion: function I get:
*** Terminating app due to uncaught exception 'GameKit Exception', reason: 'expected GKPlayer, got G:297795793 ([player isKindOfClass:[GKPlayer class]]) [__60-[NSArray(GKPlayerCanonicalization) _gkInternalsFromPlayers]_block_invoke (GKPlayer.m:662)]' *** First throw call stack: ( 0 CoreFoundation 0x0000000104502c65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010419bbb7 objc_exception_throw + 45 2 CoreFoundation 0x0000000104502b9d +[NSException raise:format:] + 205 3 GameCenterFoundation 0x0000000110eac2b2 __60-[NSArray(GKPlayerCanonicalization) _gkInternalsFromPlayers]_block_invoke + 221 4 GameCenterFoundation 0x0000000110e73883 __49-[NSArray(GKCollectionUtils) _gkFilterWithBlock:]_block_invoke + 16 5 CoreFoundation 0x000000010444c026 __53-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]_block_invoke + 70 6 CoreFoundation 0x000000010444bf5c -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 284 7 GameCenterFoundation 0x0000000110e73863 -[NSArray(GKCollectionUtils) _gkFilterWithBlock:] + 136 8 GameCenterFoundation 0x0000000110e8dd9b -[GKLeaderboard scoreRequestForGame:] + 50 9 GameCenterFoundation 0x0000000110e8e07b __57-[GKLeaderboard loadScoresForGame:withCompletionHandler:]_block_invoke + 44 10 GameCenterFoundation 0x0000000110ee2a1d -[GKDispatchGroup perform:] + 511 11 GameCenterFoundation 0x0000000110e8dfe5 -[GKLeaderboard loadScoresForGame:withCompletionHandler:] + 202 12 HLCY TapIt 0x000000010211ae1b __35-[GameCenterManager syncGameCenter]_block_invoke174 + 1051 13 libdispatch.dylib 0x00000001076f0186 _dispatch_call_block_and_release + 12 14 libdispatch.dylib 0x000000010770f614 _dispatch_client_callout + 8 15 libdispatch.dylib 0x00000001076f9552 _dispatch_root_queue_drain + 1768 16 libdispatch.dylib 0x00000001076fab17 _dispatch_worker_thread3 + 111 17 libsystem_pthread.dylib 0x0000000107a7c637 _pthread_wqthread + 729 18 libsystem_pthread.dylib 0x0000000107a7a40d start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException
Please let me know how to better collect debug information to help diagnose. I'm not very familiar with the best way. I did find that when I comment out [self syncGameCenter]
(https://github.com/nihalahmed/GameCenterManager/blob/master/GC%20Manager/GameCenterManager.m#L1001) the error doesn't occur.
Will try to look further into this issue.
Hi,
I have this crash happens randomly , not always and happens mainly on iPad not on iPhone.
It happens mainly when my game wants to report the game-score using the following
[[GameCenterManager sharedManager] saveAndReportScore:bestScore leaderboard:@"2048Heroes" sortOrder:GameCenterSortOrderHighToLow];
I have traced through "GameCenterManager.m" to the following check in this method
- (void)saveAndReportScore:(int)score leaderboard:(NSString *)identifier sortOrder:(GameCenterSortOrder)order;
when the crash happens
if ([self checkGameCenterAvailability] == YES) {
#if TARGET_OS_IPHONE
GKScore *gkScore = [[GKScore alloc] initWithLeaderboardIdentifier:identifier];
#else
GKScore *gkScore = [[GKScore alloc] initWithCategory:identifier];
#endif
Could you please help?
Thanks
Thank you Sam for updating GCM for 10.10 compatibility.
After downloading a fresh copy of it, and changing the com.xxxxx.GameCenterManager.Mac to my domain, and creating the App ID on developer.apple.com, I was able to successfully run the GCM demo under the Mac side.
However every run I get:
"Player is not signed into GameCenter, has declined to sign into GameCenter, or GameKit had an issue validating this game / app"
I am logged in and I have the sandbox enabled. Any suggestions on why it says I'm not signed in or how to troubleshoot?
Thanks.
Any ideas? The GameCenterManager files are as given and displays the following error when the Game Center Delegate :
GC Availabilty: {
message = "Player is not signed into GameCenter, has declined to sign into GameCenter, or GameKit had an issue validating this game / app.";
title = "Player not Authenticated";
}
This is the outline of my iPad app layout: The first .h view controller that the navigation controller loads. A UIButton loads the Game Center page:
As the issue is that Game Center isn't connecting, I suspect the issue is in the App delegate?:
For the sake of completion, here is the GameCenterViewController (the UIView with the buttons):
I've followed the guide very closely and have tried both with the version 5.3 and 5.2 and I can never get across the most basic point... getting users to login to game center.
I just get the following message each time I try to authenticate a player:
"GC Availability: {\"message\"=>\"Player is not signed into GameCenter, has declined to sign into GameCenter, or GameKit had an issue validating this game / app.\", \"title\"=>\"Player not Authenticated\"}"
I'm triple-checked that I've set up everything in iTunes connect correctly and that should all be fine.
Where does GameCenterManager actually ask the user to sign in on Mac? Any suggestions to the problem?
Please make encryption an optional.
U.S. export restrictions are awful.
I've notice that the delegate method gameCenterManager:availabilityChanged:
gets called after a call to checkGameCenterAvailability
, no matter if the true status changed or not, which gets called on init
, syncGameCenter
, saveAndReportScore:leaderboard:sortOrder:
, saveAndReportAchievement:percentComplete:shouldDisplayNotification:
, and getChallengesWithCompletion:
.
While this doesn't seem too bad, I think it should not be called UNLESS something actually changed. If there are reason that it should remain this way, please enlighten me. I love to learn reasons for things like this that I may not have foreseen.
Otherwise, I invite anyone to help optimized this as I will try to do so as well.
Thanks.
You may be able to help, as I am pulling my hair off this issue.
In short, each time I call
[[GameCenterManager sharedManager] presentLeaderboardsOnViewController:self];
after having called any UIViewController using a custom transition, the GameCenter controller appear but stay unresponsive to the user.
Any ideas?
Scores greater than max int value (2147483647) not being saved on Game Center. I think the error is located in - (void)saveAndReportScore:(int)score leaderboard:(NSString *)identifier sortOrder:(GameCenterSortOrder)order method. score should be long long and not int.
Having checkGameCenterAvailability:
run in the initialisation of the class means that the availabilityChanged
delegate method will never get called under the following circumstances,
• No internet
• Device does not support Game Center
• User has declined the sign in screen in the past
This is due to the initialisation being called before the delegate is set and the delegate cannot be set without first initialising the class.
I have a workaround by wrapping the delegate call backs in a dispatch block like so:
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSDictionary *errorDictionary = @{@"message": @"Player is not signed into GameCenter, has
declined to sign into GameCenter, or GameKit had an issue validating this game / app.", @"title":
@"Player not Authenticated"};
if ([[self delegate] respondsToSelector:@selector(gameCenterManager:availabilityChanged:)])
[[self delegate] gameCenterManager:self availabilityChanged:errorDictionary];
});
It is a slight oversight but possibly something you could look at changing in the future.
Hi,
I'd like to use this on the app using spritekit, but I don't know how to display leaderboard. Please show me how to do that.
I use the saveAndReportAchievement method, but in the consol i got this message:
no bundle for bundleID: (null)
The gamecenter save the achievement progress, but no notification banner shoes up, it's works before IOS9.
Anyone can help me?
Ty
Why this function won't give me the flexibility to add completion block (it's Apples GKGameCenterControllerDelegate method):
Hi:
For some reason the progress never increases. I am trying to get the percentComplete
to increase the more times the user plays the game. Currently is just sticks at PROGRESS: 0.000000
.
Thoughts?
double progress = [[GameCenterManager sharedManager] progressForAchievement:@"played500"];
NSLog(@"PROGRESS: %f", progress);
progress += (100/500);
[[GameCenterManager sharedManager] saveAndReportAchievement:@"played500" percentComplete:progress shouldDisplayNotification:NO];
Hi,in the Report Score section ,the document tell me "Report a score to Game Center using a Game Center Leaderboard ID. The score is saved locally then uploaded to Game Center (if Game Center is available)." . But I don't know how could I get it.
I was looking at GameCenterManager, and I implemented it just like the sample app. On app launch it asks me to sign into Game Center. Once I'm signed in I never get asked again to authenticate. However, when I download a came (mostly recently Words & Cards https://itunes.apple.com/us/app/words-cards/id592497491?mt=8) it didn't ask me to log in when I first launched. It just automatically logged me in. How can I do this type of autosignin with GCM? How can authenticate the user without popping up the dialog?
I think they displayed in the beginning but somehow they don't show up anymore.
reportedAchievement is called and the achievement shows up in Game Center.
shouldDisplayNotification:YES is used.
Any other idea what could be wrong?
Is it possible that resetted achievements don't popup anymore?
Hi,
I've got an issue with GCManager. When I try to submit score or report achievement, the app is terminating due to uncaught exception
'NSInvalidArgumentException', reason '*** - [NSKeyedUnarchiver initForReadingWithData:]; incomprehensible archive
Authenticating local player player works fine, but reporting something crashes app. Have you any idea what can be a reason of this problem?
I use XCode 5.0 and my iOS app is compatible with iOS >= 7.0.
Doing some tests and in testing the OSX Game Center never successfully syncs.
I'll find the cause.
Initial Findings:
[AVConference]: GKSConnSettings: set server: {
"gk-cdx" = "17.155.127.221:4398";
"gk-commnat-cohort" = "17.155.127.223:16386";
"gk-commnat-main0" = "17.155.127.222:16384";
"gk-commnat-main1" = "17.155.127.222:16385";
}
14:34:07.092362 [NSLog]: The requested operation could not be completed due to an error communicating with the server.
Rewrite the existing Objective-C Multiplayer class in Swift.
"In future updates, GameCenter Manager will make it easy to setup and run live Game Center Multiplayer matches." - when you planning to make it? Thank you for your work!=)
Hi,
I m using this in the last 1.5 years and It stops working.
The delegate get called after 120 seconds (2 minutes!!!) ath this function:
gameCenterManager:userCanceledAuthentication:
With this error:
Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)"
How can I close the GamekitViewController as when I press "done" nothing happens. Instead if I go to the GameCenterManager.m in the method and add the following:
[viewController performSelector:@selector(dismissModalViewControllerAnimated:) withObject:NO afterDelay:5];
It exits the controller and returns to the previous one . Any suggestions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.