gamekit

Updating the matchData in a GKTurnBasedMatch without ending the turn

旧巷老猫 提交于 2019-12-09 18:38:27
问题 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? 回答1: 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" 回答2: You can call

iPhone: Sending large data with Game Kit

放肆的年华 提交于 2019-12-09 12:56:15
问题 I am trying to write an app that exchanges data with other iPhones running the app through the Game Kit framework. The iPhones discover each other and connect fine, but the problems happens when I send the data. I know the iPhones are connected properly because when I serialize an NSString and send it through the connection it comes out on the other end fine. But when I try to archive a larger object (using NSKeyedArchiver) I get the error message "AGPSessionBroadcast failed (801c0001)". I am

Streaming songs to connected devices using gamekit

跟風遠走 提交于 2019-12-08 09:28:58
问题 I want to play the song from one iphone to the other, it is like the user from device A selects a song from his IPod and plays it, while the users on Device B can also listen to that song using their own iphone which is connected to the Device A using either the Game Kit or wifi. So is it possible to stream the song from the ipod library to the other devices or not. 回答1: This is not possible technically, because you can't get to the audio data -- either as a decoded PCM stream or as the

Turn-based matchmaking not working in iOS 10

蹲街弑〆低调 提交于 2019-12-08 03:16:43
问题 My game was working fine before iOS 10. Now, everyone with iOS 10 can't invite and play with who they want. When a user says they want to play multiplayer, I create a GKMatchRequest like this: GKMatchRequest *request = [[GKMatchRequest alloc] init]; request.minPlayers = 2; request.maxPlayers = 4; request.defaultNumberOfPlayers = 2; I use a GKTurnBasedMatchmakerViewController to handle the invitation, etc. The user sees an interface that would let them change the number of players in the match

iOS USB HID programming

99封情书 提交于 2019-12-07 17:53:54
问题 I am trying to make some code regarding USB HID devices. I have found an article about Bluetooth programming which uses Game Kit Framework. Now I'm looking for some tutorial or maybe some code to work on connecting HID device via USB. Where should I look? Is Game Kit the right way? Is it difficult to implement communication between iOS and HID device? 回答1: You can use IOKit for USB, but it's a private framework on iOS - so it depends if you want to deploy to the App Store. Here is the USB

Check if you've already unlocked an achievement in Game Center/GameKit

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 17:35:27
问题 I've been stumped on this for quite a long time. I understand how to unlock an achievement in Game Center and I even got a whole messaging system working. But I can't figure out how to check if an achievement has already been unlocked :( Apparently this doesn't work: GKAchievement *achievement = [[GKachievement alloc] initWithIdentifier:ident] autorelease]; NSLog(@"%i",achievement.completed); It always traces "0". Unlocking an achievement does work: GKAchievement *achievement = [

fatal error: can't unsafeBitCast between types of different sizes (using gamekit)

最后都变了- 提交于 2019-12-06 15:42:12
Using GameKit Multiplayer feature (EasyGameCenter) found here: https://github.com/DaRkD0G/Easy-Game-Center-Swift Upon two players connecting I get a crash on this line let playerIDs = match.players.map { $0 .playerID } as! [String] With this in console fatal error: can't unsafeBitCast between types of different sizes Any ideas? Here is full function for easy reference: @available(iOS 8.0, *) private func lookupPlayers() { guard let match = EGC.sharedInstance.match else { EGC.printLogEGC("No Match") return } let playerIDs = match.players.map { $0 .playerID } as! [String] /* Load an array of

Turn-based matchmaking not working in iOS 10

ε祈祈猫儿з 提交于 2019-12-06 05:15:25
My game was working fine before iOS 10. Now, everyone with iOS 10 can't invite and play with who they want. When a user says they want to play multiplayer, I create a GKMatchRequest like this: GKMatchRequest *request = [[GKMatchRequest alloc] init]; request.minPlayers = 2; request.maxPlayers = 4; request.defaultNumberOfPlayers = 2; I use a GKTurnBasedMatchmakerViewController to handle the invitation, etc. The user sees an interface that would let them change the number of players in the match and invite players. Let's say that they only want 2 players, so they leave that and they want to play

Handle invitation to GKTurnBasedMatch without game center view controllers

我与影子孤独终老i 提交于 2019-12-06 03:29:10
问题 I am working on a simple turn-based word game, and I'm having a difficult time figuring out how invitations are working. When user A invites user B to a game, I want user B to be able to see this game in my custom match interface (ie a screen where all of user B's games are listed). Things are fine if user B clicks on the notification when he is invited to a game, but I still want the game to be visible through my own interface if user B just navigates to the app on his own. Whenever this

Check if you've already unlocked an achievement in Game Center/GameKit

岁酱吖の 提交于 2019-12-06 02:15:38
I've been stumped on this for quite a long time. I understand how to unlock an achievement in Game Center and I even got a whole messaging system working. But I can't figure out how to check if an achievement has already been unlocked :( Apparently this doesn't work: GKAchievement *achievement = [[GKachievement alloc] initWithIdentifier:ident] autorelease]; NSLog(@"%i",achievement.completed); It always traces "0". Unlocking an achievement does work: GKAchievement *achievement = [[GKachievement alloc] initWithIdentifier:ident] autorelease]; achievement.percentComplete = 100; So it's not that I