I've got an app I'm ready to submit to Apple except for testing Game Center integra开发者_Go百科tion with their servers. That's where I've hit the following snag.
I've installed the app on my device, which is plugged into my laptop, and running the app in debug mode from XCode. When submitting an achievement or high score using GKAchievement or GKScore, I have been getting nothing but GKErrorCommunicationsFailure errors sent to the completion handler all day today (my first day trying). The app logs in to Game Center successfully and quickly, and the device can get on the internet with no difficulty for web sites (including Apple's), but these errors are all I can get out of the call to score/achievement-submission routines.
(The good news is that I've therefore thoroughly tested my handling of such an error! :) But now I'd like to see some submissions succeed!)
Any idea what might be causing this, or is the error actually correct, and I just picked the coincidentally worst network day to try this out?
I found out the problem, and so am answering my own question:
The GKErrorCommunicationsFailure is an umbrella for any number of different errors you might get from communicating with the server. It does not mean only a connection problem, for example.
In my case, it was that I had slightly different names for achievements/leaderboards in my code than on iTunes Connect (spaces in the code, no spaces on iTunes Connect). Thus the error was really trying to indicate that there was no such achievement/leaderboard to post.
精彩评论