GameKit - iCloud Sign In Error

Hi everyone,

I'm trying to implement matchmaking in visionOS using GameKit and GameCenter.

I'm following the example project that been shared but I get an error.

Error: The requested operation could not be completed because you are not signed in to iCloud..

I'm getting this error as a result of matchmaking. I'm already logged in to iCloud in Vision Pro Simulator. I've tried to switch off-on every related settings but didn't work.

I'm using latest Xcode Dev Beta and visionOS Beta v6.

Would you mind share me any workaround?

Regards, Melih

Replies

For the full explanation of the error:

Error Domain=GKErrorDomain Code=35 "The requested operation could not be completed because you are not signed in to iCloud." UserInfo={NSLocalizedDescription=The requested operation could not be completed because you are not signed in to iCloud., NSUnderlyingError=0x600000c8df20 {Error Domain=GameDaemonCore.PseudonymManagerError Code=0 "(null)"}}

Kindly note that my localPlayer is authorized but I cannot get into matchmaking due to iCloud error. I even added iCloud Container within entitlements but didn't work.

Probably too late to help, but I just had a same error on my macOS recently.

Turns out I just needed to sign out of iCloud and sign in again in the system. When I signed back in (with the same account), I needed to accept new terms of service so maybe it was stuck on that.

I'll add my two cents here since I was also hitting this.

It was giving me this error (which I think was a false positive) simply because I wasn't encoding the data correctly.

I was trying to encode using a JSONEncoder when I should have been using a PropertyListEncoder.

Here is a working code snippet:

let encoder = PropertyListEncoder()
let data = try encoder.encode(self.gameData)
let savedGame = try await player.saveGameData(data, withName: "game.data")