Git Product home page Git Product logo

gamecentermanager's Introduction

A Note on Swift Conversion

This branch of the project is currently being refactored and rewritten in Swift. Please contibute to help finish the conversion and improve the project. Once completed, the projct will switch over to Swift from Objective-C. Until that time, this branch is not ready for production use.

GameCenter Manager helps to manage Game Center in iOS and Mac apps. Report and track high scores, achievements, and challenges for different players. GameCenter Manager also takes care of the heavy lifting - checking internet availability, saving data when offline and uploading it when online, etc. On iOS (and soon on other platforms) GameCenter Manager makes it easy to setup and run live peer-to-peer Game Center Multiplayer matches.

If you like the project, please star it on GitHub! Watch the project on GitHub for updates. If you use GameCenter Manager in your app, send an email to [email protected] or let us know on Twitter @iRareMedia.

Project Features

GameCenter Manager is a great way to use Game Center in your iOS or OS X app. Below are a few key project features and highlights.

  • Sync, submit, save, retrieve, and track any Game Center leaderboards, achievements, or challenges in only one line of code.
  • Setup and manage peer-to-peer multiplayer Game Center matches
  • Just drag and drop the files into your project - no complicated setup
  • Useful delegate methods and properties let you access and manage advanced Game Center features
  • iOS / OS X sample apps illustrate how easy it is to use GameCenter Manager

Project Information

Learn more about the project requirements, licensing, and contributions.

Requirements

  • Built with and for Objective-C ARC
  • Requires a minimum of iOS 7.0 / OS X 10.9 as the deployment target
  • Requires Xcode 5.0.1 for use in any iOS Project
  • Uses Apple LLVM compiler 5.0

Requirements

  • Requires iOS 7.0+ or OS X 10.9+. The sample project is optimized for iOS 8 and OS X 10.10.
  • Requires Automatic Reference Counting (ARC).
  • Optimized for ARM64 Architecture

Requires Xcode 6 for use in any iOS or OS X project. Requires a minimum of iOS 7.0 or OS X 10.9 as the deployment target.

Current Build Target Earliest Supported Build Target Earliest Compatible Build Target
iOS 9.0 iOS 7.0 iOS 7.0
OS X 10.11 OS X 10.9 OS X 10.9
Xcode 7.1 Xcode 6.1.1 Xcode 6.0
LLVM 6.1 LLVM 6.1 LLVM 5.0

REQUIREMENTS NOTE
Supported means that the library has been tested with this version. Compatible means that the library should work on this OS version (i.e. it doesn't rely on any unavailable SDK features) but is no longer being tested for compatibility and may require tweaking or bug fixes to run correctly.

License

You are free to make changes and use this in either personal or commercial projects. Attribution is not required, but is appreciated. We have spent a lot of time, energy, and resources working on this project - so a little Thanks! (or something to that affect) would be much appreciated. If you use GameCenter Manager in your app, send an email to [email protected] or let us know on Twitter @iRareMedia. See the full GameCenter Manager license here.

Contributions

Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.

Sample App

GameCenter Manager's demo app makes it easier to test Game Center integration with GameCenter Manager on both Mac and iOS. It also lays out how to use the GameCenterManager class. We recommend that you leave the Bundle ID provided with the Demo App as-is. This Bundle ID is already linked to a Game Center game in iTunes Connect with scores and achievements. You may, however, substitute your own Bundle ID and entitlements file.

Documentation

All methods, properties, types, and delegate methods available on the GameCenterManager class are documented below. If you're using Xcode 5 with GameCenter Manager, documentation is available directly within Xcode (just Option-Click any method for Quick Help).

Setup

Setting up GameCenter Manager is very straightforward. These instructions do not detail how to enable Game Center in your app. You need to setup Game Center before using GameCenter Manager. Refer to the wiki pages for details on that.

  1. Add the GameKit, SystemConfiguration, and Security frameworks to your Xcode project

  2. Add the following classes (can be found in the GC Manager folder) to your Xcode project (make sure to select Copy Items in the dialog):

    • GameCenterManager
    • Reachability
    • NSDataAES256
  3. Import the GameCenterManager.h file

  4. You can initialize GameCenterManager and begin syncing by using the following method call:

     [[GameCenterManager sharedManager] setupManager]; // Or use setupManagerAndSetShouldCryptWithKey: for use with encryption
    
  5. Add the delegate GameCenterManagerDelegate to your header file, then set the delegate in your implementation and add any delegate methods you'd like to use (see Delegates):

     [[GameCenterManager sharedManager] setDelegate:self];
    

Methods

There are many methods available on iCloud Document Sync. The most important / highlight methods are documented below. All other methods are documented in the docset and with in-code comments.

Initialize GameCenterManager

You should setup GameCenterManager when your app is launched. This should only be done once and can be done in the application: didFinishLaunchingWithOptions: method of your AppDelegate.

[[GameCenterManager sharedManager] setupManager];

This initializes GameCenter Manager, checks if Game Center is supported on the current device, authenticates the player and synchronizes scores and achievements from Game Center. Alternatively, you can call the following method to enable encryption of local data:

[[GameCenterManager sharedManager] setupManagerAndSetShouldCryptWithKey:@"YourKey"];

These methods are not interchangable. If you decide to setup with encryption then you should never revert to setting up without encryption, and vice versa. Doing so will cause issues with archiving and unarchiving the saved data - which results in a crash. Pick one and stick with it forever. If you do change it, you'll need to delete the GameCenterManager.plist file from your app's library (inside the bundle).

Check Game Center Support

GameCenter Manager automatically checks if Game Center is available before performing any Game Center-related operations. You can also check for Game Center availability by using the following method, which returns a BOOL value (YES / NO).

// Will not call delegate if status has not changed from the previous time it was called
BOOL isAvailable = [[GameCenterManager sharedManager] checkGameCenterAvailability:NO];

// Will always call delegate even if status has not changed from the previous time it was called
BOOL isAvailable = [[GameCenterManager sharedManager] checkGameCenterAvailability:YES];

This method will perform the following checks in the following order:

  1. Current OS version new enough to run Game Center. iOS 4.1 or OS X 10.8. Some Game Center methods require newer OS versions which will be checked (ex. challenges and some multiplayer features).
  2. GameKit API availability. The GKLocalPlayer class must be available at a minimum.
  3. Internet Connection. The Reachability class is used to determine if there is an active internet connection. GameCenterManager will still work without internet, however all saved data can only be uploaded with an internet connection.
  4. Local Player. Check to make sure a local player is logged in and authenticated.

This method may return NO in many cases. Use the gameCenterManager:availabilityChanged: delegate method to get an NSDictionary containing information about why Game Center is or isn't available. Refer to the section on delegate methods below.

Report Score

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).

[[GameCenterManager sharedManager] saveAndReportScore:1000 leaderboard:@"Leaderboard ID"  sortOrder:GameCenterSortOrder];

Set the Game Center Sort Order (either GameCenterSortOrderHighToLow or GameCenterSortOrderLowToHigh) to report a score to Game Center only if the new score is better than the best one (depending on the sort order). There is no need for you to find out if a user has beat their highscore before submitting it - GameCenterManager will determine if the score should be submitted based on the parameters provided.

Report Achievement

Report an achievement to Game Center using a Game Center Achievement ID. The achievement and its percent complete are saved locally then uploaded to Game Center (if Game Center is available).

[[GameCenterManager sharedManager] saveAndReportAchievement:@"Achievement ID" percentComplete:50];

The percentComplete parameter specifies how much progress the user has made on an achievement. Specifiying a value of 100 will mark the achievement as completed. Values submitted between 1-99 will display in Game Center and show the user that they need to make more progress to earn an achievement. if you specify an achievement percent complete lower than the current percent complete, it will be ignored by Game Center.

Get High Scores

You can get high scores from multiple leaderboards or just one leaderboard. In both cases you'll need to provide Leaderboard IDs. GameCenterManager will return either an NSDictionary with integer scores, or one integer score. To get the high scores for the current player from multiple leaderboards:

// Array of leaderboard ID's to get high scores for
NSArray *leaderboardIDs = [NSArray arrayWithObjects:@"Leaderboard1", @"Leaderboard2", nil];

// Returns a dictionary with leaderboard ID's as keys and high scores as values
NSDictionary *highScores = [[GameCenterManager sharedManager] highScoreForLeaderboards:leaderboardIDs];  

To get the high score for the current player for a single leaderboard:

// Returns an integer value (long long integer) as a high scores

long long highScore = [[GameCenterManager sharedManager] highScoreForLeaderboard:@"LeaderboardID"];

Get Achievement Progress

You can get achievement progress for multiple achievements or just one achievement. In both cases you'll need to provide Achievement IDs. GameCenterManager will return either an NSDictionary with double values, or one double value. To get the achievement progress for the current player from multiple achievements:

// Array of achievement ID's to get progress for
NSArray *achievementIDs = [NSArray arrayWithObjects:@"Achievement1", @"Achievement2", nil];

// Returns a dictionary with achievement ID's as keys and progresses as values
NSDictionary *achievementsProgress = [[GameCenterManager sharedManager] progressForAchievements:achievementIDs];  

To get the achievement progress for the current player for a single achievement:

// Returns a double value as achievement progress
double progress = [[GameCenterManager sharedManager] highScoreForLeaderboard:@"LeaderboardID"];  

Reset Achievements

Erase and reset all achievement progress from Game Center. Be warned though, the resetAchievements: method does not prompt the user before resetting - you must do this on your own. Currently, achievements are properly removed from Game Center, however a caching issue causes them to remain locally. Please submit a pull request if you can fix this issue.

[[GameCenterManager sharedManager] resetAchievementsWithCompletionHandler:^(NSError *error) {
    if (error) NSLog(@"Error: %@", error);
}];

When the resetAchievements: method is called and resets all achievements, the completion handler is fired. Use the completion handler for retrieving errors or updating user interface elements (ex. updating a table view listing completed achievements).

Get Challenges

Get challenges for the current game and player on iOS 6 and higher (GameCenterManager will check if challenges are supported on the current device). This method uses a completion handler to pass data (either an NSError or NSArray with the challenges. If the GKChallenge class or GameCenter is not available, the gameCenterManager: error: delegate method is called.

// Gets an array with challenges and passes the value to a completion handler.
[[GameCenterManager sharedManager] getChallengesWithCompletion:^(NSArray *challenges, NSError *error) {
    NSLog(@"Challenges: %@ \n Error: %@", challenges, error);
}];

If there is an error retrieving the challenges, the NSArray will be nil and the NSError will contain an error. The NSError passed here is an error generated by Game Center, not GameCenterMananger

Presenting GameKit ViewControllers

GameCenter Manager makes the presentation of GameKit ViewControllers easy one-liners.

To present the leaderboards view controller, call the following method:

 // If you have one leaderboard, present the leaderboard
 // If you have more than one, shows all leaderboards and allows player to choose which one to show
 [[GameCenterManager sharedManager] presentLeaderboardsOnViewController:self withLeaderboard:nil];

 // Presents the leaderboard with the ID of LeaderboardID
 [[GameCenterManager sharedManager] presentLeaderboardsOnViewController:self withLeaderboard:@"LeaderboardID"];

To present the achievements view controller, call the following method:

 [[GameCenterManager sharedManager] presentAchievementsOnViewController:self];

To present the challenges view controller, call the following method:

 [[GameCenterManager sharedManager] presentChallengesOnViewController:self];

Player Data

GameCenterManager provides four different methods to retrieve various bits of data about the current local player. Retrieve a player ID using the following method, but never display a player ID in your interface or expose the ID in any way at all - it should only be used to identify a player. If you display a player ID in your app, it will be rejected from the AppStore.

NSString *playerID = [[GameCenterManager sharedManager] localPlayerId];  

To get the player's display name (alias on iOS lower than iOS 6.0) use this method:

NSString *playerName = [[GameCenterManager sharedManager] localPlayerDisplayName];  

To get the player's profile picture the following method. On iOS, the completion handler passes a UIImage, on OS X the completion handler passes an NSImage. The image passed to you is at full resolution.

[self localPlayerPhoto:^(UIImage *playerPhoto) { // On OS X, the completion handler pases an NSImage instead of a UIImage
    UIImageView *imageView = [[UIImageView alloc] initWithImage:playerPhoto];
}];    

To get any other data about a player use this method:

GKLocalPlayer *player = [[GameCenterManager sharedManager] localPlayerData]; 

Delegates

GameCenter Manager delegate methods notify you of the status of Game Center and various other tasks. There is only one required delegate method for iOS, none for OS X.

Authenticate User (Required, iOS only)

If the user is not logged into Game Center, you'll need to present the Game Center login view controller. This method is required because the user must be logged in for Game Center to work. If the user does not login, an error will be returned.

 - (void)gameCenterManager:(GameCenterManager *)manager authenticateUser:(UIViewController *)gameCenterLoginController

Availability Changed

When the availability status of Game Center changes, this delegate method is called. The availability of Game Center depends on multiple factors including: * Internet Connection * iOS Version (4.1+ required) * Player Authentication * Game Authentication

The NSDictionary object, availabilityInformation, contains two objects, a message and a title. The message object is an NSString describing the availability issue. The title is a shorter description of the error; it is also an NSString.

- (void)gameCenterManager:(GameCenterManager *)manager availabilityChanged:(NSDictionary *)availabilityInformation

Game Center Error

When there is an error performing a Game Center task this delegate method is executed.

The error NSError object contains an error code (refer to the section on Constants below), a description (error domain) and sometimes user information.

- (void)gameCenterManager:(GameCenterManager *)manager error:(NSError *)error

Reported Score

Called after the submitted score is successfully saved, uploaded, and posted to Game Center.

The GKScore object, score, is the final score that was saved. The error object may contain an error if one occured, or it may be nil.

- (void)gameCenterManager:(GameCenterManager *)manager reportedScore:(GKScore *)score withError:(NSError *)error;

Saved Score

Called after the submitted score is successfully saved, but not posted or uploaded to Game Center. The saved score will be uploaded the next time GC Manager can successfully connect to Game Center.

The GKScore object, score contains information about the submitted score.

- (void)gameCenterManager:(GameCenterManager *)manager didSaveScore:(GKScore *)score

Reported Achievement

Called after the submitted achievement and its percent complete is successfully saved, uploaded, and posted to Game Center.

The GKAchievement object, achievement, is the final achievement that was saved. The error object may contain an error if one occured, or it may be nil.

- (void)gameCenterManager:(GameCenterManager *)manager reportedAchievement:(GKAchievement *)achievement withError:(NSError *)error

Saved Achievement

Called after the submitted achievement is successfully saved, but not posted or uploaded to Game Center. The saved achievement and its percent completed will be uploaded the next time GC Manager can successfully connect to Game Center.

The GKAchievement object, achievement, is the final achievement that was saved.

- (void)gameCenterManager:(GameCenterManager *)manager didSaveAchievement:(GKAchievement *)achievement

Constants

Constants are used throughout GameCenter Manager in error messages and method parameters.

Score Sort Order

The order in which your leaderboard scores are sorted. This helps GameCenterManager decide how to submit a score to a leaderboard (and determine if it is a highscore).
- GameCenterSortOrderHighToLow sorts scores from highest to lowest
- GameCenterSortOrderLowToHigh sorts scores from lowest to highest

Error Codes

When the gameCenterManager: error: delegate is called, one of the following error codes are passed.
- GCMErrorUnknown (0) an unknown error occured
- GCMErrorNotAvailable (1) the feature is not available or GameCenter is not available
- GCMErrorFeatureNotAvailable (2) the request feature is not available, check error message for info
- GCMErrorInternetNotAvailable (3) no internet connection - GCMErrorAchievementDataMissing (3) could not save achievement because the data was formatted improperly or is missing

gamecentermanager's People

Contributors

ahmedrezik avatar danm72 avatar danoli3 avatar michael-patzer avatar nihalahmed avatar rolyrolls avatar sam-spencer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gamecentermanager's Issues

Ability to login again if user decline login first time ?

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.

Score Overwrite

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?

Cocos2D-swift

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!

Modules don't work with Objective-C++ (.mm)

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
screen shot 2015-12-15 at 9 21 16 pm
Doesn't matter with Objective-C++... does not work.

tvOS support

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

Can't login on iPad iOS 8.0 beta 2

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.

Adding achievements to my game

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?

Uncaught exception when reporting achievement/score

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.

Swift Version

Any plans to create a Swift version of this great app?

Get/Set percentComplete issue?

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];

How can I get the Leaderboard ID?

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.

Player is not signed into GameCenter...

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?

screen shot 2015-01-18 at 11 13 39 am
screen shot 2015-01-18 at 11 13 46 am
screen shot 2015-01-18 at 11 14 39 am

Thanks.

Possible oversight with availabilityChanged delegate method

Having checkGameCenterAvailability: run in the initialisation of the class means that the availabilityChangeddelegate 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.

saveAndReportAchievement error

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

Remove Encryption

Please make encryption an optional.
U.S. export restrictions are awful.

How to use with spritekit?

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.

GameCenter Leaderboard show crashes

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

OSX Save file - Saved in Common ~/Library/GameCenterManager.plist D:

Okay huge bug!

In OSX the plist for the Game Center Manger is currently saved here:
/Users/username/Library/GameCenterManager.plist

screen shot 2015-11-13 at 12 38 22 pm

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)

No Visible @interface for 'GameCenterManager' declares the selector 'initGameCenter'

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,

Joe
screen shot 2014-04-19 at 10 39 06 am

Doesn't 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.)"

setupManager isn't logging me in automatically on first launch

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?

Present Login Screen Programmatically

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!

Scores greater than 2147483647 not saved on Game Center.

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.

Achievements not syncing

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];
}

Game Center Only ever sync's with the cloud once.

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.

Current version apparently not compiling on Mac OS?

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 -------------------------------------------------------------------------------------//
 //------------------------------------------------------------------------------------------------------------//

Critical Bug for saveScoreToReportLater

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];

Game Center Achievement completion banner not showing

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?

How can we retrieve the player rank in a given leaderboard?

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.

Request GKScore

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)
            }
        }
    }
}

Player never asked to log in on Mac

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?

Game Center Multiplayer matches

"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!=)

CocoaPods Support

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

-[GKScore initWithLeaderboardIdentifier:]: unrecognized selector sent to instance

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

SpriteKit

I'm not quite sure how to integrate this with SpriteKit. I've been searching for answers but none turned up.

Unresponsive with UIModalPresentationCustom called beforehand

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?

When should it init GameCenterManager?

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 ?

Error on: resetAchievementsWithCompletion:

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.

[Swift Refactor] Split Manager Class

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.

Don't see Notification Banner using Cocos2d

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...)

Delegates called too often gameCenterManager:availabilityChanged:

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.

Closing Game View Controller

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?

completion block for leaderboard dismiss?

Why this function won't give me the flexibility to add completion block (it's Apples GKGameCenterControllerDelegate method):

  • (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController {
    [gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
    }

GameKit issue validating my game!

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:
screen shot 2013-11-28 at 18 22 25

As the issue is that Game Center isn't connecting, I suspect the issue is in the App delegate?:
screen shot 2013-11-28 at 18 21 27

For the sake of completion, here is the GameCenterViewController (the UIView with the buttons):
screen shot 2013-11-28 at 18 23 12

screen shot 2013-11-28 at 18 56 48

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.