gamekit

swift - Jump only when landed

江枫思渺然 提交于 2019-12-23 15:37:53
问题 I'm looking to restrict my character (cat), to only jump when it's either on the ground (dummy SKNode), or when on the tree (treeP SKNode). Currently I don't have any restrictions to touchesBegan and as a result the cat is able to fly through the air if the user clicks in quick succession, whilst this could be useful in other games it's not welcome here. If anyone could help me I'd be really happy. What i would like to do but have no experience would be to enable a click (jump), if the cat

GKLocalPlayer authentication not working, but isAuthenticated returns YES (Game Center sandbox)

我怕爱的太早我们不能终老 提交于 2019-12-23 15:29:36
问题 I'm working on integrating turn based matches in my game and a few days ago I started getting weird errors from the GameKit API saying that the local player is not authenticated, even though he is. When I launch the app, the authenticateHandler is called, the view controller is displayed and after entering the password, the authenticaHandler is called again and the local player seems to be authenticated. isAuthenticated returns YES . But as soon as I start using any of the GameKit APIs like

Changing source file type to Objective-C++ causes linker error when using GameKit

爷,独闯天下 提交于 2019-12-23 10:51:23
问题 So I am using Xcode 6.1 on my Objective-C app. My app uses the GameKit framework. I tried to call external C++ methods from my GameViewController (which is Objective-C source.) To make GameViewController.mm compile, I had to set the type to 'Objective-C++ Source' manually. However, even though the source now compiles, it will fail to link with: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GLKViewController", referenced from: _OBJC_CLASS_$_GameViewController in GameViewController

How do I identify an empty NSData Object that appears as empty brackets?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 08:12:32
问题 I am dealing with a corruption issue in Game Kit's GKTurnBasedMatch class (see this thread) which sometimes results in an invalid game state, with corrupted matchData. So as a workaround, I'm creating a way out a way to identify these invalid matches so I can deal with them appropriately. The corrupted matchData seems like a good way to do this. However, so far I've been unable to identify them. When I do this: // "match" is an existing GKTurnBasedMatch object NSLog(@"match data is: %@",

GameKit server disconnect makes session invalid

谁都会走 提交于 2019-12-23 02:18:12
问题 I'm trying to build a 4 player multiplayer game using GameKit. I tried many things and I'm currently using client/server mode, meaning that I have 1 session in GKSessionModeServer and 3 other sessions connecting to this one in GKSessionModeClient. My goal is, that when a user leaves the game or gets disconnected for whatever reason, that the others can continue their game. So far this works if any of the Clients leave the game, but if the Sevrer leaves the game, send and receive calls are not

Swift Displaying Game Center Leaderboards

风流意气都作罢 提交于 2019-12-22 11:08:36
问题 Right now I am trying to make a leaderboard I created show up. The player is authenticated just fine, but when the game center window opens it is very strange. Here is a picture: Here is the code I am using to display this image: override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { self.showLeaderboard() } func showLeaderboard() { var leaderView = UIViewController() var leaderViewController = GKGameCenterViewController(rootViewController: leaderView) leaderViewController

Maximum size of GKTurnBasedMatch matchData

北城余情 提交于 2019-12-22 10:45:35
问题 I've been searching for a definitive answer on this, but I get some inconsistent answers. Apple docs state 64k bytes. However, online I find multiple sources that say 4k bytes is the max. Is this a difference between iOS 5 and iOS 6? 回答1: It was 4KB, now its 64KB. Source: https://developer.apple.com/news/index.php?id=02012012a 回答2: Definative, or not, but I think that the previous limit was 4 kB, and that that limit now has been raised to 64k. Not 100% sure, though. 回答3: There is a read only

iOS Wifi-Direct Communication

强颜欢笑 提交于 2019-12-21 23:17:58
问题 I'm wondering if there's a way for two iPhones to communicate with Wifi-Direct Exclusively. (No Bluetooth, No Servers, Just Wifi-Direct) Correct me if I'm wrong, but MultiPeerConnectivity, GameKit, and CFNetServices don't allow using exclusively Wifi-Direct. If they do can someone show me an example? Thanks for your time! 回答1: The Multipeer Connectivity framework does not support Wi-Fi Direct but it does support direct ad-hoc connections between two iOS devices using a proprietary Apple

Sandbox Game Center Turn Event Notifications Not Consistent

拟墨画扇 提交于 2019-12-21 05:30:22
问题 I'm making a turn-based game, using the Game Center Turn-Based Gaming functionality. I'm using the simulator and my iPhone to test notifications of turn events. The results are very inconsistent. About 75% of the time when I make a move on the simulator and pass the turn I don't get any notifications on my iPhone. It seems that this function doesn't get called: handleTurnEventForMatch:didBecomeActive: I set the GKEventHandlerDelegate in the code that authenticates the local user and it seems

How do I convert an NSNumber to NSData?

跟風遠走 提交于 2019-12-20 17:34:35
问题 I need to transmit an integer through GameKit using sendDataToAllPeers:withDataMode:error: but I don't know how to convert my NSNumber to NSData in order to send. I currently have: NSNumber *indexNum = [NSNumber numberWithInt:index]; [gkSession sendDataToAllPeers:indexNum withDataMode:GKSendDataReliable error:nil]; but obviously the indexNum needs to be converted to NSData before I can send it. Does anyone know how to do this please? Thanks! 回答1: I would not recommend NSKeyedArchiver for such