Get GKPlayer.playerID from GKCloudPlayer.playerID

436 views Asked by At

I want to use new class GKGameSession in my iOS 10 multiplayer game. I need to get the playerID of all users from Game Center to check compatibility with previous versions of my game. But GKPlayer.playerID != GKCloudPlayer.playerID

How can I get GKPlayer.playerID from GKCloudPlayer.playerID?

1

There are 1 answers

0
KugelnMMXVI On BEST ANSWER

You are not supposed to do this. They metioned this in the last WWDC.

GKCloudPlayer is only for, to be used for Sessions. It basically has two pieces of data, a player ID that is unique to your app as well as the display name, that is what the user will have as what they want they name to be displayed. This is not a GKPlayer object at all.

If you try to use this for a leaderboard, for achievements, for other multiplayer, for anything else, it will not work. So please don't do that.

Everyone will be very disappointed. So how do we get our Cloud Players? Basically you can get your current signed in player.

Most of the things in Sessions basically are going to be called from your current player though there's not a whole lot of need to make sure that you have the player, that you are then saying, "Oh, this player is saving this data." All that's handled for you in the background.

https://developer.apple.com/videos/play/wwdc2016-611/?time=1139