开发者

Does [GKLocalPlayer localPlayer] ever return valid info on first call?

What is the point of calling...

GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];

As far as I can tell, this always returns an object will all fields set to nil, regardless of the start of the currently signed in player. It's not until you call...

[localPlayer authenticateWithCompletionHandler:^(NSError *error)

...that you get a player. Is this call only to get an object to then call authenticateWithCompletionHandler: from?

Is it safe to assume that on this very first call, it will never have valid player information? I was assuming that it had开发者_如何学C the player info for the player logged into Game Center on the device, but that isn't the case (that would be too handy).

What should the game do during the time waiting for a valid playerID? On a bad connection, players could have completed achievements and even get a score. I know you're supposed to save information until a connection is made, but without a playerID, I can't save it tagged for a specific player like you would do during a simple failure to send a score.

In my above example, player A start the game, get a score and quit the game before they were ever authenticated. Then Player B logs on and starts the game and gets the score from player A.

If I save the last playerID and just use that, you get into the situation of player B starting a game after player A and all scores go to player A, or are lost for player A when player B starts.

Or is it just not worth worrying about stuff like this because it's <1% likely to ever happen?

Or am I just missing the simple solution to all this stuff?

Game Center is just a complete mess of edge cases. Apple could have done a much better job on this API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜