game-center

Swift - Game Center not available

二次信任 提交于 2019-12-01 08:56:38
I'm trying to implement Game Center in my Swift game. I have a menu view controller, where the user can press a "SCORES" button, which should take them to the Game Center view controller. This is the code that runs in the menu vc, when the button is pressed: var gcViewController: GKGameCenterViewController = GKGameCenterViewController() gcViewController.gameCenterDelegate = self gcViewController.viewState = GKGameCenterViewControllerState.Leaderboards gcViewController.leaderboardIdentifier = "VHS" self.presentViewController(gcViewController, animated: true, completion: nil) I have code in the

Good practices for Game Center matchData

烈酒焚心 提交于 2019-12-01 07:56:55
问题 I am new to GKTurnBasedMatch and i'm trying to figure out what are good practices for the "matchData" sent between players during turns. All the tutorials i've found mainly cover sending a string of text and I would like to send a lot more than that. It would be great if someone could pint me to a more advanced tutorial. An example of what I would like to do is a battle. The two players have their avatars and they have different details (health, attack, defence, etc), how should I send this

How to list all available GKTurnBasedMatches for a player?

↘锁芯ラ 提交于 2019-12-01 06:46:34
I'm building a game using Game Center's turn based matches. I want to display a list of all the available matches. I've tried using loadMatchesWithCompletionHandler() , but the array of games returns as nil , and the error also returns as nil . There are some ongoing matches. This is what I have so far: func authenticateLocalUser() { if !gameCenterAvailable { return } let player = GKLocalPlayer.localPlayer() if player.authenticated == false { player.authenticateHandler = {(viewController, error) -> Void in if viewController != nil && self.presentingViewController != nil { self

Swift - Game Center not available

空扰寡人 提交于 2019-12-01 05:40:52
问题 I'm trying to implement Game Center in my Swift game. I have a menu view controller, where the user can press a "SCORES" button, which should take them to the Game Center view controller. This is the code that runs in the menu vc, when the button is pressed: var gcViewController: GKGameCenterViewController = GKGameCenterViewController() gcViewController.gameCenterDelegate = self gcViewController.viewState = GKGameCenterViewControllerState.Leaderboards gcViewController.leaderboardIdentifier =

Game Center Multiplayer using GKMatch but seems can't be connected

十年热恋 提交于 2019-12-01 05:31:14
问题 Hi I'm a new bie in Game Center for iOS. I'm trying to add the multiplayer feature using matches to my game and following the documentation. So far I reached a point where 2 of my clients can successfully get a match, i.e. the matchmakerViewController:didFindMatch callback is called and a GKMatch object is delivered. However after that I seems to be stuck there forever, because according to the documentation, I'll have to wait until all the players (2 in my case) are actually connected before

How to list all available GKTurnBasedMatches for a player?

一个人想着一个人 提交于 2019-12-01 05:10:40
问题 I'm building a game using Game Center's turn based matches. I want to display a list of all the available matches. I've tried using loadMatchesWithCompletionHandler() , but the array of games returns as nil , and the error also returns as nil . There are some ongoing matches. This is what I have so far: func authenticateLocalUser() { if !gameCenterAvailable { return } let player = GKLocalPlayer.localPlayer() if player.authenticated == false { player.authenticateHandler = {(viewController,

Some startBrowsingForNearbyPlayersWithReachableHandler questions

試著忘記壹切 提交于 2019-12-01 04:18:11
问题 I'm trying to get local matchmaking working in GameKit using [[GKMatchmaker sharedMatchmaker] startBrowsingForNearbyPlayersWithReachableHandler:] . Essentially, I'm trying to implement interface-less local matches: as long as there's a player in my local vicinity, I want to connect and start a match. Importantly, I only want to do this for local players: I never want to match automatically over the internet. I've enabled Game Center for my app in iTunes connect and signed up for a different

Game Center authentication error

匆匆过客 提交于 2019-11-30 21:51:07
I'm trying to call the authentication method of game center, however no authentication screen comes up and the callback return with an error : "the requested operation has been canceled". The code : [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { NSDictionary *userInfo = nil; if (error == nil) { NSLog(@"Game Center successfully authenticated"); } else { userInfo = [NSDictionary dictionaryWithObject:error forKey:@"NSError"]; } [[NSNotificationCenter defaultCenter] postNotificationName:Notification object:self userInfo:userInfo]; }]; Any idea what can cause

Is there any web api for Apple's Game Center? [closed]

非 Y 不嫁゛ 提交于 2019-11-30 15:23:17
I have a website. I was wondering if Apple exposed its Game Center data via a web api. If would be cool if I could show users their Game Center info right in my website! Let me know folks. I think it may still be under NDA as I had to log on to look at the game center docs... I did find a non apple site with a getting started pdf . it contains an interesting passage: The data maintained by the Game Center service should only be used to provide the services and functionality necessary for your application, and may not be transferred or copied to other services. For example, you may not download

How to accept an invitation in Game Center

时光毁灭记忆、已成空白 提交于 2019-11-30 14:34:26
I'm trying to implement invitations with Game Center and there's one thing that i don't understand. Ok, i've sent an invitation from one device to another. Then i have an UIAlertView on receiver which asks me i would like to accept or decline the invitation. when i accept it it is handled like this: [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