Posts

Post not yet marked as solved
0 Replies
432 Views
I have a Game Center game with two different entries in App Store Connect (i.e. two different Apps with different Bundle IDs, one for iOS and macOS). I want the game to handle multiplayer across both platforms. Do I need the "App Groups" entitlement for this? Or is it sufficient if both are listed in App Store Connect under App Information / Multiplayer Compatibility?
Posted
by Fault.
Last updated
.
Post not yet marked as solved
0 Replies
640 Views
this GKAccessPoint code fails on macOS. The AccessPoint button appears, but disappears when clicked -- no modal window. works fine on iOS but not macOS. what am i doing wrong? import SwiftUI import GameKit struct AccessPoint: View { var body: some View { ZStack { Color.clear Text("GKAccessPoint") } .onAppear() { GKLocalPlayer.local.authenticateHandler = { viewController, error in GKAccessPoint.shared.isActive = true } } } }
Posted
by Fault.
Last updated
.
Post not yet marked as solved
0 Replies
403 Views
wondering if anyone can help clear up an error that i get when calling GKTurnBasedMatch.saveCurrentTurn. this error happens irregularly, but seems to be exacerbated by rapid successive calls to saveCurrentTurn. Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo={GKServerStatusCode=5002, NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server., NSUnderlyingError=0x600002e1f480 {Error Domain=GKServerErrorDomain Code=5002 "status = 5002, Unexpected game state version expectedGameStateVersion='d9a7ea8c-f1de-4d35-8607-bc3c9bc1ebda' foundGameStateId='fc0f793d-4b88-4594-9b52-22ce2c1ae4fc' sessionId='1418932146:390cf165-49fc-40fb-aba7-08ff452d8500'" UserInfo={GKServerStatusCode=5002, NSLocalizedFailureReason=status = 5002, Unexpected game state version expectedGameStateVersion='d9a7ea8c-f1de-4d35-8607-bc3c9bc1ebda' foundGameStateId='fc0f793d-4b88-4594-9b52-22ce2c1ae4fc' sessionId='1418932146:390cf165-49fc-40fb-aba7-08ff452d8500'}}} is there a way to avoid this error? here is a unit test that demonstrates the above error -- error happens irregularly but frequently up to 20% of the time. let total:Int = 100 var fail:Int = 0 func test_StressTest_saveCurrentTurn() { guard let match = GKTurnBasedMatch_loadMatches()?.first else { return } for i in 0..<total { GKTurnBasedMatch_saveCurrentTurn(match, Data([UInt8(i)])) } print("failed \(fail) times out of \(total) total") } func GKTurnBasedMatch_saveCurrentTurn(_ match:GKTurnBasedMatch, _ payload:Data) { let expectation = self.expectation(description:"expectation") print("\(Self.self) \(#function)") match.saveCurrentTurn(withMatch:payload) { error in if let error = error { print("\(error)") self.fail += 1 } expectation.fulfill() } wait(for:[expectation], timeout: 5) }
Posted
by Fault.
Last updated
.
Post not yet marked as solved
1 Replies
655 Views
i'm trying to use exchanges and localization. i'm getting different results on iOS versus on macOS. i have the following line in my Localizable.strings (English) file "emote_message_hello" = "hello"; here's my sendExchange function: gkTurnBasedMatch.sendExchange(to:[opponent],                    data:Data(),                    localizableMessageKey:"emote_message_hello",                    arguments:[],                    timeout:TimeInterval(1)) and here is my receivedExchangeRequest function   func player(_ player:GKPlayer, receivedExchangeRequest exchange:GKTurnBasedExchange, for gkTurnBasedMatch: GKTurnBasedMatch) {     print("\(exchange.message)") } on macOS this outputs "hello". yet the same code on iOS outputs "emote_message_hello". in other words it appears that macOS is automatically localizing the string, while iOS is not. am i doing something wrong or is this a bug?
Posted
by Fault.
Last updated
.
Post marked as solved
1 Replies
689 Views
i have a macOS app that uses Game Center. how do i make it available to beta testers? i understand that TestFlight is available to developers running macOS v12. but my testers are normal users who are running macOS v11. my first thought was to sign with a Developer ID and let testers download the app. except that Game Center is not supported in Developer ID apps. Can I sign and upload to App Store Connect and somehow offer the binary to testers?
Posted
by Fault.
Last updated
.
Post not yet marked as solved
0 Replies
414 Views
is it possible to write unit tests that involve game center authentication and match methods? this would help a great deal with debugging. or do i need a mock window/view of some kind for authenticateHandler to trigger?class GameCenterTests: XCTestCase { override func setUp() { super.setUp() GKLocalPlayer.local.authenticateHandler = { viewController, error in ... } } func test_EndTurn() { GKTurnBasedMatch.load(withID:id) { gkTurnBasedMatch, error in ... } } }
Posted
by Fault.
Last updated
.