Post not yet marked as solved
We're implementing multiplayer using GameKit's realtime match functionality and are seeing a certificate error on certain iOS devices when attempting to call GKMatchRequest.
The request fails with the exception: "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “init.gc.apple.com” which could put your confidential information at risk."
This only appears to affect a small number of iOS devices, namely:
iPad 6 on iOS 14.8
iPad Mini 6th gen
iPad Mini 5th gen
Other iOS devices and other platforms match without issues. We've tried multiple different wifi networks on these devices (including cellular hotspot) to try to rule out local network issues. Has anyone run into this?
Post not yet marked as solved
I have saved games being implemented in iCloud via GameKit code in my app. It has been working correctly for months.
However, I recently encountered an issue with saved game conflicts.
The 'conflict detected' callback of GameKit is being triggered. I am trying to properly handle this, but it's not working.
This is what I am currently doing:
Receive the callback
I am passed 2 saved game instances
I chose the instance with the newest modification time stamp
I call GameKitLoad with that chosen saved game instance
I successfully receive a byte[] of data loaded from the saved game instance
I then call GameKitResolveConflicts with the following parameters --- Param 1: the original array of 2 saved game instances --- Param 2: the byte[] received after loading the newest instance --- Param 3: my callback
I also verify that the parameters I am passing are non-null, non-zero-length, and have valid data
However, I get the following error printed out to my log
"The requested operations could not be completed because one or more parameters are invalid."
And then my callback is invoked with a 'false' result status.
From this point on, all iCloud functions fail and saving / loading is impossible.
I am unsure what is wrong, but any assistance is greatly appreciated.
Thank you for your time
When authenticating the GKLocalPlayer.localPlayer with Game Center the console logs a message:
_authenticateUsingAlert:Failed to authenticate player with existing credentials.Error: Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognised by Game Center." UserInfo={GKServerStatusCode=5019, NSLocalizedDescription=The requested operation could not be completed because this application is not recognised by Game Center., NSUnderlyingError=0x600001fc57a0 {Error Domain=GKServerErrorDomain Code=5019 "status = 5019, no game matching descriptor: ios:***.***.***:1.4:4+-1" UserInfo={GKServerStatusCode=5019, NSLocalizedFailureReason=status = 5019, no game matching descriptor: ios:***.***.***:1.4:4+-1}}}
After this, I CAN access the player properties such as avatar and name, but Game Center will not show any leaderboards or achievements, nor can scores be submitted.
iOS 15.2, on any device or Simulator the same happens.
I have tried EVERYTHING I could find on the web:
check correct bundle ID
create a leaderboard in App Store Connect
create an achievement in App Store Connect
create a whole new app in App Store Connect
create a whole new project in Xcode
delete and re-add Game Center capability
use a different Apple ID to sign in to Game Center
use a different Apple Developer Account and do the above again
I do have two other games in which everything works fine. In many old posts about this, no one ever got any answer or solution, so I am thinking Apple's backend system is buggy.
If anyone has ANY information on how to solve, please help.
Hi all,
I'm working on my first game, and the first step of getting the authenticator view is not working. To simplify the problem, I made a brand new app which only has the following code in the main view controller:
import GameKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
GKLocalPlayer.local.authenticateHandler = { viewController, error in
NSLog("GameKit authenticating")
if let vc = viewController {
NSLog("IT WORKED! \(vc.description)")
} else {
NSLog(error!.localizedDescription)
}
}
}
}
I've looked through older, similar issues, and so I made sure that I'd done the following:
Game center is enabled in the app's Capabilities in Xcode.
I've created an app associated with the bundle ID in App Store Connect.
In the app's Services tab, I've created two leader boards, one "classic single".
Also in Services, I've created one achievement.
In the app's "prepare for submission" panel, I've turned on gamecenter, linked the leaderboards, and linked the achievement.
For this test app, I have not yet uploaded a build, but I did do so on the actual game app, and and that didn't fix it.
And with all that done, in my logs, it looks like this:
2022-01-16 16:28:01.582366-0800 test1ofgamecenter[6863:1006170] [Account Error] startAuthenticationForExistingPrimaryPlayer:Failed to Authenticate player.Error: Error Domain=GKErrorDomain Code=15 "The requested operation could not be completed because this application is not recognized by Game Center." UserInfo={NSLocalizedDescription=The requested operation could not be completed because this application is not recognized by Game Center.}
2022-01-16 16:28:01.976807-0800 test1ofgamecenter[6863:1006170] GameKit authenticating
2022-01-16 16:28:01.976988-0800 test1ofgamecenter[6863:1006170] The requested operation could not be completed because this application is not recognized by Game Center.```
I notice that my achievements and leaderboard are not "live" and I presume that is because I have not submitted the app for review, but I want to get it working before I submit a build that I would expect and want to be rejected.
Is there anything else I need to do? Does this configuration require human intervention by Apple staff members? I started this phase of the development Friday evening, so I guess it'd make sense if waiting until Monday would fix it, but that seems weird.
Any help?
Vital Stats:
- M1 Macbook Air
- Xcode 13.2.1 (13C100)
- Macos Monterey 12.1
- Testing on an iPhone XR and a 2021 iPad Mini, both with the most recent updates of their respective OS's
Post not yet marked as solved
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
}
}
}
}
Post not yet marked as solved
I'm trying to connect two players with each other using GameKit in a very simple game. I want to use GKMatchmaker.shared().findMatch as I don't want to show any GameCenter related view controllers. (to keep it simple)
Problem:
Even though GameKit creates a match after finding two players, an error occurs that prevents either player from sending any message to the others.
Current Situation:
The basic code is as follows (based on the docs described here: https://developer.apple.com/documentation/gamekit/finding_multiple_players_for_a_game)
print("Requesting multiplayer match")
let request = GKMatchRequest()
request.minPlayers = 2
request.maxPlayers = 2
request.recipientResponseHandler = {(player: GKPlayer, respnse: GKInviteRecipientResponse) -> Void in
print("new player about to join")
print(player.alias)
print(respnse)
}
GKMatchmaker.shared().findMatch(for: request, withCompletionHandler: {
(match: GKMatch?, error: Error?) -> Void in
if error != nil {
// Handle the error that occurred finding a match.
print("error during matchmaking")
print(error as Any)
} else if match != nil {
guard let match = match else { return }
print("connected to \(match.players.count) players")
// load the multiplayer data handler
let handler = MultiMatchHandler()
match.delegate = handler
// load the multiplayer service
let service = MultiMatchService(match: match)
service.sendMessageToAll(text: "Hello from the other side")
// finish the match making
GKMatchmaker.shared().finishMatchmaking(for: match)
// Start the game with the players in the match.
self.view?.presentScene(GameScene.newScene(multiplayer: service))
}
})
The output of that is
Requesting multiplayer match
2022-01-05 01:19:16.554959+0100 Grapefruit[38300:10026027] [Match] cannot set connecting state for players: (
"<GKPlayer: 0x282add280>(alias:... gamePlayerID:... teamPlayerID:... name:... status:(null) friendBiDirectional:0 friendPlayedWith:1 friendPlayedNearby:0 acceptedGameInviteFromThisFriend:0 initiatedGameInviteToThisFriend:0 automatchedTogether:1)"
), as there is no inviteDelegate set yet. The state might directly change to Ready when we set the inviteDelegate later and call sendQueuedStatesAndPackets.
2022-01-05 01:19:16.557002+0100 Grapefruit[38300:10026027] [Match] syncPlayers failed to loadPlayersForLegacyIdentifiers: (
"..."
)
connected to 0 players
sending text Hello from the other side failed
Findings:
minPlayers is set to 2. As the completion handler is called this means that at least one more player was found. But the number of players returned in match.players.count is 0
The matcher shows an error saying that cannot set connecting state for players ... as there is no inviteDelegate set yet. I can't find any info about this invite delegate.
Actual Question:
What is an inviteDelegate? Do I really need to implement such (if yes, then how?)? (I don't think so as the docs state that the match only starts after the invites are accepted).
How can I resolve this issue?
Post not yet marked as solved
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)
}
Post not yet marked as solved
It seems that some people have asked questions before, but I haven't got an answer, so I'd like to ask you a question.
Since playerID is deprecated, when I replaced the relevant part with teamPlayerID, it seems that the format of teamPlayerID obtained from the property of localPlayer and the format of teamPlayerID obtained from Players in GKMatch passed by the delegate function didChangeConnectionState are different. For this reason, comparison by ID is not working well. Is this a malfunction of the OS etc.?
Or is there another way to link the teamPlayerID obtained from GKMatch with the teamPlayerID obtained from localPlayer?
Also, I haven't figured out the cause yet. I received a report that a program using playerID is not running on monterey. Is playerID completely abolished in monterey?
Post not yet marked as solved
I'm certain this has been asked before, but I do not want to use sks files. I have some very old Cocos2d code that I'm trying to port without a complete rewrite. I would rather programatically move my scene sprites around based on the screensize and do it in Obj-C.
It is unclear to me how to do this. I sort of found an answer here:
https://stackoverflow.com/questions/43927323/are-spritekit-scene-sks-files-necessary-in-my-project
Tried to do something equivalent in Obj-C, but got no where.
Post not yet marked as solved
GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.recipients = @[ invitePlayer ];
GKMatchmakerViewController *mmvc = [[VCGKMATCHMAKERVIEWCONTROLLER alloc] initWithMatchRequest:request];
[self.parentViewController presentViewController:mmvc animated:YES completion:nil];
Before iOS 15, I can use previous code to present a view and click "Invite and Start" button to invite player to play match, but in iOS 15, the view has 2 buttons "Invite Friends" and "Start Game", both buttons are disabled, and I can't send invite, Does anyone can help me?
Post not yet marked as solved
in Trying to reinstall an app and it keeps saying I have to have a new developer code
Post not yet marked as solved
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController * __nullable viewController, NSError * __nullable error) {
// not enter this code !!!
};
// not open game center auth page.
Post not yet marked as solved
What is the support number for Game Center
Post not yet marked as solved
Hello,
I am trying to load a player avatar for a given ID.
On the GKPlayer documentation page, it is recommended to use the loadPlayers(forIdentifiers:withCompletionHandler:) method to retrieve GKPlayer objects which can then be used in the loadPhoto(for:withCompletionHandler:) method.
However, the documentation for loadPlayers states, that this function is deprecated since iOS 14.5.
XCode suggests to use the GKLocalPlayer.loadFriends method (documentation).
Anyway, this is not a replacement for loadPlayers since loadFriends, as the name suggests, only loads players from the friends list instead of a global list.
It is weird that the GKPlayer docs suggest the use of loadPlayers which is deprecated. Is there a workaround to this?
Best regards
I’m the developer of a health and fitness macOS app called Simon Says previously known as Sluggard. It’s been around for a few years already, and currently I’m working on a new major version update.
I am currently considering adding achievements and leaderboards, but I am not sure if a “regular” app is eligible for GameKit and its features. It seems like CloudKit would be more suitable for that. Am I right?
GameKit has almost everything I need. The only problem is that my app is not a game at all.
Post not yet marked as solved
Hi,
I'm trying to implement the following Fast Start code shown during WWDC 2021 .
However, I'm getting an error on the GameSceneViewController line. I've tried this with both a Game and an App template in Xcode 13, but both get hung up here.
Can anyone help me make this work?
Thank you so much
Post not yet marked as solved
Hey!
My friend and I recently developed an app with leaderboards. We had the scoring system set to higher for testing purposes, leading to me having a score that is relatively unobtainable with the scoring system we launched with. However, when we launched (https://www.example.com/ https://evergreenapk.com/) the leaderboards weren't scrubbed, so my score is way beyond everyone else. My score is the only one affected, so would it be possible to remove my all-time scores and utilize the ones I've earned since our launch? Please let me know!
Post not yet marked as solved
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?
Post not yet marked as solved
When I try to retrieveScores from the gamecenter I get the error: "Couldn’t communicate with a helper application."
The leaderboard I am trying to get scores from is a recurring leaderboard.
Previously I have called LoadLeaderboardIds.
I am using Prime31 unity plugin to communicate with GameCenter.
Before updating prime31 I had no errors, however I needed to update the plugin to be able to get recurring leaderboards.
I asked on the Prime31 forum, but was told that: "That sounds like an internal Apple error. App code cant launch or communicate with helper apps, only Apple's code can do cross-process communication. You'll want to open a bug report directly with Apple."
The error happens on the iOS build but I have not tested other platforms yet.
Post not yet marked as solved
Hello every one,
Is there an full example of how to implement loadFriends in objective-c?
https://developer.apple.com/documentation/gamekit/gklocalplayer/3726201-loadfriends?language=objc
Thanks!