game-center

iOS Development: Strange problem with authenticating Game Center user

ぃ、小莉子 提交于 2019-12-03 15:43:24
问题 I'm building an iPhone game that supports Game Center (GC). When the app launches, I try to authenticate the local player... if([GKLocalPlayer localPlayer].authenticated == NO) { [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { [self callDelegateOnMainThread: @selector(processGameCenterAuth:) withArg: NULL error: error]; }]; } Everything seemed to be working well. If the user wasn't signed into GC when the app launched, the app would display a dialog box

iOS Development: When receiving a Game Center invite, how do I obtain the GKMatch object?

只谈情不闲聊 提交于 2019-12-03 15:01:19
问题 I'm building an iPhone game that uses Game Center and I'm having a hard time understanding how to start a match game that was started by receiving an invitation to play from a friend. The docs say this... The acceptedInvite parameter is non-nil when the application receives an invitation directly from another player. In this situation, the other player’s application has already created the match request, so this copy of your application does not need to create one. According to this, I don't

Gamecenter authentication issue

旧城冷巷雨未停 提交于 2019-12-03 13:21:20
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"); } else { NSLog(@"user not authenicated"); } }; } Here's what is shown when it crashes: 2014-11-12 16

Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement)

此生再无相见时 提交于 2019-12-03 12:43:21
I have a 100% reproducible crash here. Crash if backgrounding cocos2d 2.1 app in iOS7 while watching Game Center screens (leaderboard, achievement). It crashes instantly when pushing the home button. Crash on line 275 in CCGLView.m: if(![_context presentRenderbuffer:GL_RENDERBUFFER]) The itching thing is, I downloaded a fresh copy of official cocos2diphone 2.1 the other second, installed its templates and ran the staple application after hooking it up to the same app id as my problematic app that already have game center leaderboards etc set up. It does not crash. So I ran a diff on the

Offline Game Center iOS Achievements

天涯浪子 提交于 2019-12-03 12:38:40
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:^(NSArray *gcAchievments, NSError *error) { if (error) { ..skipped ..} //This dictionary will store

Xcode 4.6 ARC Warning for Game Center Authentication

依然范特西╮ 提交于 2019-12-03 12:14:12
This is a new compiler warning that only showed up when I updated XCode to 4.6. My code is lifted directly from Apple's documentation (this is my iOS 6 code btw). GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error) { [self setLastError:error]; if(localPlayer.authenticated){ Warning--Capturing 'localPlayer' strongly in this block is likely to lead to a retain cycle The issue is that the localPlayer object is keeping a strong reference to itself - when localPlayer is "captured" for use within the

Removing a GKTurnBasedMatch which is in an invalid state

牧云@^-^@ 提交于 2019-12-03 11:30:39
问题 I am doing some experimentation to try to learn about GameKit and I made a simple game and an interface which lists my player's matches. I am trying to add the ability to remove games using the removeWithCompletionHandler: method on the match, but I am having trouble removing a GKTurnBasedMatch which seems to have entered an invalid state. A po of the match in question prints: $0 = 0x1d590d20 <GKTurnBasedMatch 0x1d590d20 id:858d8257-cc49-4060-b1d8-38c09a929e3c status:Ended message: taken:2013

iOS Game Center GameKit Programmatic Invite Matchmaking

半腔热情 提交于 2019-12-03 09:53:52
问题 I'm trying to implement a real-time multiplayer game with a custom UI (no GKMatchMakerViewController). I'm using startBrowsingForNearbyPlayersWithReachableHandler: ^(NSString *playerID, BOOL reachable) to find a local player, and then initiating a match request with the GKMatchmaker singleton (which I have already initiated). Here's where I'm having trouble. When I send a request, the completion handler fires almost immediately, without an error, and the match it returns has an expected

iPhone Simulator 6.0 not able to connect to gamecenter in sandbox mode

孤人 提交于 2019-12-03 09:00:07
I'm trying to implement a gamecenter aware app targeted to iOS 6. To give some info on the environment I'm working on mac os 10.7.5 with XCode version is 4.5.2 and xcode is running iphone and ipad simulator version 6.0. The problem is I cannot connect to gamecenter in sandbox mode neither through ipad or iphone simulator, but the same code works as desired while testing in my iphone. I followed the gamecenter programming guide in apple's developer library and I got this atm it is called from applicationDidFInishLaunching in appdelegate: - (void)authenticateLocalUser:(UIViewController *

IOS Game Center GKLocalPlayerListener

只谈情不闲聊 提交于 2019-12-03 06:35:19
I was trying to implement an event listener in a turn based game so a player can receive when his turn is active or when he is invited by a friend. GKTurnBasedEventHandler is deprecated in IOS 7 and i read in the documentation that i should use GKLocalPlayerListener; but that's the extend of it. Is there someone who used it already, because there is no info anywhere. This is what i tried before, and it does not work. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];