Achievements flaky - frequent "error communicating with the server"

I’m just beginning to work on adding achievements to a game, and I’m running into a lot of problems.  The most basic one is this: I try to retrieve the list of achievements from the server, and I get the following error:

<Warning>: {

 errorCode = 3,

 errorMessage = “The requested operation could not be completed due to an error communicating with the server.”,

 name = “gameNetwork”,

 provider = “gamecenter”,

 type = “loadAchievementDescriptions”

}

We have one achievement set up in iTunes Connect.

I got that error consistently when I built the app in Corona and told Corona to open it in the XCode emulator or to copy it directly to my iPhone.  When I built an ipa file using the distribution profile for the app, and copied that ipa to my iPhone using XCode, then it finally started working!  That error went away, and I was able to receive a list of achievements, and unlock achievements!  And then this morning it stopped working again and I started getting that error again.  I don’t think I changed anything between yesterday when it was working and today when it stopped.

Any ideas on troubleshooting this kind of error when it happened?  The error message is not very informative.

I’ve updated to the latest nightly and to XCode 7.2.  I also tried resetting achievements at the beginning of the game, just to get to a baseline starting place.

At the moment, I’m not getting the error described above, but I’m also not successfully retrieving the list of achievements.  My callback from getting achievements looks like this:

 {

 name = “gameNetwork”,

 provider = “gamecenter”,

 type = “loadAchievementDescriptions”

}

When I do a call to unlock achievements later in the game, it does actually seem to work (if I look at the game center I see that I got that achievement) but the banner it’s supposed to show when it happens never actually appears.  I call it like this:

      gameNetwork.request( “unlockAchievement”,

      {

          achievement = {

            identifier = identifier,

            showsCompletionBanner = true,

          },

          listener = callback

      });

and apparently it works but I see no banner.

Hi @ed91,

I just tested our Game Center sample app, with a minor tweak to the code (simply setting “showsCompletionBanner” to true instead of false), and I’m getting a banner to show up when I reach 100 (percent).

Out of curiosity, can you edit your code and add the “percentComplete” parameter set to 100? Our documentation says that if it’s not specified, it is “assumed” to be 100, but I want to confirm if this is a documentation issue or something else.

[lua]

gameNetwork.request( “unlockAchievement”,

     {

          achievement = {

            identifier = identifier,

            percentComplete = 100, – ADD THIS

            showsCompletionBanner = true,

          },

          listener = callback

      });

[/lua]

Best regards,

Brent

This morning I have a completely different set of issues.

On my physical device, I can’t log in to the game center at all.  

 {

 data = true,

 errorCode = -1001,

 errorMessage = “The operation couldn’t be completed. (NSURLErrorDomain error -1001.)”,

 name = “gameNetwork”,

 provider = “gamecenter”,

 type = “init”

}

This was working fine yesterday.  No code has changed, just rebuilt and reinstalled.  I opened the game center app on my phone and made sure I was logged in.

Meanwhile, in the XCode device emulator, everything works beautifully, including the banner, including downloading the achievement list which had been failing – both with and without the 100 percent completion parameter supplied.

Over the past 2 days and today, I’ve seen several completely different patterns of “stuff working” and “stuff not working” either with zero changes to the code, or else regardless of any changes to the code I do make.  Maybe this is some extreme flakiness on Apple’s part?

Hi @ed91,

Game Center can be a fickle thing sometimes and I’ve experienced some head-scratching moments where it works one day, stops working the next, works an hour later, etc.

Of course, I don’t want to blame that for issues you’re having IF they are related to Corona’s Game Center plugin. The main thing is, we should try to get some sense of consistency going, then try to locate the source of the problem from there. But if you’re not getting any consistency on your side, that could be tricky…

By the way, what version of iOS is your device running? And what actual device is it? Have you searched online to see if developers outside of Corona are experiencing similar issues? Please search StackOverflow or Apple’s forums to help determine if this is an Apple issue or a potential Corona issue.

Take care,

Brent

It was an iPhone 5S, running the latest iOS, and… I’ve since then put the “problem” app out on testflight and it’s working fine with another tester, and now it’s working fine on my device.

I think I’m going to chalk this one up to “flaky Apple,” since nothing I’ve done in Corona specifically has either caused or solved any problems.  Thanks very much for being here to listen through this weirdness. :slight_smile:

I’ve updated to the latest nightly and to XCode 7.2.  I also tried resetting achievements at the beginning of the game, just to get to a baseline starting place.

At the moment, I’m not getting the error described above, but I’m also not successfully retrieving the list of achievements.  My callback from getting achievements looks like this:

 {

 name = “gameNetwork”,

 provider = “gamecenter”,

 type = “loadAchievementDescriptions”

}

When I do a call to unlock achievements later in the game, it does actually seem to work (if I look at the game center I see that I got that achievement) but the banner it’s supposed to show when it happens never actually appears.  I call it like this:

      gameNetwork.request( “unlockAchievement”,

      {

          achievement = {

            identifier = identifier,

            showsCompletionBanner = true,

          },

          listener = callback

      });

and apparently it works but I see no banner.

Hi @ed91,

I just tested our Game Center sample app, with a minor tweak to the code (simply setting “showsCompletionBanner” to true instead of false), and I’m getting a banner to show up when I reach 100 (percent).

Out of curiosity, can you edit your code and add the “percentComplete” parameter set to 100? Our documentation says that if it’s not specified, it is “assumed” to be 100, but I want to confirm if this is a documentation issue or something else.

[lua]

gameNetwork.request( “unlockAchievement”,

     {

          achievement = {

            identifier = identifier,

            percentComplete = 100, – ADD THIS

            showsCompletionBanner = true,

          },

          listener = callback

      });

[/lua]

Best regards,

Brent

This morning I have a completely different set of issues.

On my physical device, I can’t log in to the game center at all.  

 {

 data = true,

 errorCode = -1001,

 errorMessage = “The operation couldn’t be completed. (NSURLErrorDomain error -1001.)”,

 name = “gameNetwork”,

 provider = “gamecenter”,

 type = “init”

}

This was working fine yesterday.  No code has changed, just rebuilt and reinstalled.  I opened the game center app on my phone and made sure I was logged in.

Meanwhile, in the XCode device emulator, everything works beautifully, including the banner, including downloading the achievement list which had been failing – both with and without the 100 percent completion parameter supplied.

Over the past 2 days and today, I’ve seen several completely different patterns of “stuff working” and “stuff not working” either with zero changes to the code, or else regardless of any changes to the code I do make.  Maybe this is some extreme flakiness on Apple’s part?

Hi @ed91,

Game Center can be a fickle thing sometimes and I’ve experienced some head-scratching moments where it works one day, stops working the next, works an hour later, etc.

Of course, I don’t want to blame that for issues you’re having IF they are related to Corona’s Game Center plugin. The main thing is, we should try to get some sense of consistency going, then try to locate the source of the problem from there. But if you’re not getting any consistency on your side, that could be tricky…

By the way, what version of iOS is your device running? And what actual device is it? Have you searched online to see if developers outside of Corona are experiencing similar issues? Please search StackOverflow or Apple’s forums to help determine if this is an Apple issue or a potential Corona issue.

Take care,

Brent

It was an iPhone 5S, running the latest iOS, and… I’ve since then put the “problem” app out on testflight and it’s working fine with another tester, and now it’s working fine on my device.

I think I’m going to chalk this one up to “flaky Apple,” since nothing I’ve done in Corona specifically has either caused or solved any problems.  Thanks very much for being here to listen through this weirdness. :slight_smile: