game-center

GameCenter Invitation Handler

南楼画角 提交于 2019-12-05 07:27:47
trying to implement a multiplayer. Using the sample from Game Center - Sending and receiving data . Everything seems okay, but in apple documentation there is also said about invitation handler. [GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite *acceptedInvite, NSArray *playersToInvite) { // Insert application-specific code here to clean up any games in progress. if (acceptedInvite) { GKMatchmakerViewController *mmvc = [[[GKMatchmakerViewController alloc] initWithInvite:acceptedInvite] autorelease]; mmvc.matchmakerDelegate = self; [self presentModalViewController:mmvc animated:YES]; }

Gamecenter authentication issue

耗尽温柔 提交于 2019-12-04 21:08:30
问题 So I've updated the way I authenticate players for gamecenter and I'm still getting a crash at start up. This is the new way I authenticate: - (void) authenticateLocalPlayer { GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){ if (viewController != nil) { NSLog (@"user not logged in to GC"); } else if ([GKLocalPlayer localPlayer].isAuthenticated) { NSLog(@"gamecenter authentication process succeeded"

load Game Center friends and their scores into UITableView

我怕爱的太早我们不能终老 提交于 2019-12-04 19:52:07
So I was wondering after reading the apple docs( https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLeaderboard_Ref/Reference/Reference.html#//apple_ref/occ/instp/GKLeaderboard/category ) how would one create a UITableView and fill it with the localPlayers Game Center friends and there scores in a specific leaderboard. I know how to get the friends list and friends scores individually by using the loadScoresWithCompletionHandler: method. Edit: So far I got this to get individual friends photo, score and displayname saved into one NSArray. But i can't figure out how to

Underlying view disappears during game-center authentication

混江龙づ霸主 提交于 2019-12-04 19:40:21
I have an iOS application that I'm just starting to implement game center support for. I call the authenticateWithCompletionHandler method during loadView for my main (root) view controller. My main view displays, and shortly later the "sign in to game center" dialog appears exactly as expected. If "Create New Account" is selected, the game center "New Account" pop-over dialog displays in the middle of the screen (this is on an iPad) -- but my underlying main menu disappears. Underneath the pop-over dialog is just a black screen. If I dismiss the dialog in the completion handler, it goes away

Offline Game Center iOS Achievements

最后都变了- 提交于 2019-12-04 18:49:01
问题 Trying to figure out best way to work with Achievements in Game Center in case of offline mode (e.g. Airplane mode turned on). As far as I understand Game Center in iOS 5+ takes care of offline submitted achievements and scores. It acts like a proxy cache and submits them to online Game Center next time user is online. Considering this here is what I do: At the user authentication success I load achievments and store them in a dictionary. [GKAchievement loadAchievementsWithCompletionHandler:^

Game Center- handling failed achievement submissions?

纵然是瞬间 提交于 2019-12-04 18:44:55
Im a noob in game center @ games generally. Im making my second game now and implemented the game center. If the internet is available, there is no problem, everything works well. But just now I purposely make the internet unreachable, and when I get an achievement, obviously it does not register to the Game Center's Achievement. How and what's the best way to handle this issue? Thank you.... You could add the GKAchievement objects that fail to register to an array and then resend them when you get back connectivity. You should also consider committing that array to persistent storage, in case

Game center facebook like

家住魔仙堡 提交于 2019-12-04 17:02:29
So today i started developing with the new iOS 6 SDK and noticed that my game has a new Facebook Like button in Game Center(which is greyed out because i didn't specify anything on it yet). So my question is, how can i put a link of a facebook page behind that "Like" button? My iPhone game has a facebook page already btw. Thanks already, Hope it is not too late. Just watched one of WWDC videos and they said, if someone will click the like button, it'll means that person like the game and link to itunes will be generated (i guess also posted on your wall). it is not for liking your app page. I

How to make High Score of game to be saved on Leaderboard, with Swift?

百般思念 提交于 2019-12-04 14:01:17
I made a game using SpriteKit and Xcode 7 beta. I tried to put GameCenter and Leaderboard but the problem is that the score in leaderboard won't change it stay all the time 0 (High Score of game won't save in Leaderboard) and I don't know how to fix it. I'm using 3 different files: GameScene.swift , GameViewController.swift , and PointsLabel.swift . GameScene.swift func addPointsLabels() { let pointsLabel = PointsLabel(num: 0) pointsLabel.position = CGPointMake(30.0, view!.frame.size.height - 40) pointsLabel.name = "pointsLabel" addChild(pointsLabel) //High Score let highscoreLabel =

Robust Game Center Achievement code

蓝咒 提交于 2019-12-04 13:35:10
问题 In just about every example of submitting achievements to Game Center, I see this code [achievement reportAchievementWithCompletionHandler:^(NSError *error) { if (error != nil) { // Retain the achievement object and try again later (not shown). } }]; Problem is, that one little comment is about 99% of the work. I've spent the last few hours trying to figure this out and it seems to be an endless set of edge cases of sending and resending and save and loading data. Does anyone know of a nice

Updating the matchData in a GKTurnBasedMatch without ending the turn

与世无争的帅哥 提交于 2019-12-04 11:47:24
It seems that GameKit only allows GKTurnBasedMatch to be updated once per time that GKTurnBasedMatch is loaded from the Game Center servers. Is there an other way to update the matchData property? The following method was added to GKTurnBasedMatch in iOS 6.0 and will do what you need: - (void)saveCurrentTurnWithMatchData:(NSData *)matchData completionHandler:(void (^)(NSError *error))completionHandler "Update the match data without advancing the game to another player" monkeydom You can call `- [GKTurnBasedMatch (void)loadMatchDataWithCompletionHandler:(void (^)(NSData *matchData, NSError