3

There are a handful of posts discussing how Game Center's push notifications were fairly unreliable in the sandbox. However, the sandbox is obfuscated with iOS 9 so, I'm not sure why my Game Center push notifications are so unreliable.

When I reply to the active exchange, the sender is rarely notified.

[exchange replyWithLocalizableMessageKey:@"EXCHANGE_REPLY" arguments:@[] data:data completionHandler:^(NSError *error) {

            if (error)
            {
                NSLog(@"");
            }
        }];

On the senders device, if I refresh the match data, I'll see a pending reply. If I process the reply, everything works.

The same goes for this method:

- (void)sendExchangeToParticipants:(NSArray<GKTurnBasedParticipant *> *)participants
                          data:(NSData *)data
         localizableMessageKey:(NSString *)key
                     arguments:(NSArray<NSString *> *)arguments
                       timeout:(NSTimeInterval)timeout
             completionHandler:(void(^__nullable)(GKTurnBasedExchange *exchange, NSError *error))completionHandler

At this point, I'm thinking my best option is to run my own push notification logic to trigger updating match data. That or I've read that sending reminders is more reliable though I believe there are throttling limits around that.

Update

I've tried using only devices and not the simulator. Same issue. Looks like it's a pretty well known problem though. It's even noted in this book on page 766.

Update

Sending reminders didn't help.

Update

Often when replying to an exchange, I'll get this error from GameKit.

The connection to service named com.apple.gamed was interrupted, but the message was sent over an additional proxy and therefore this proxy has become invalid.
STANGMMX
  • 973
  • 7
  • 18
  • 31
  • Something to note as well, I'm using the simulator plus a device. I'm trying two devices only for now as per this post: http://stackoverflow.com/questions/7935336/how-do-i-get-notifications-for-gamekit-turn-based-matches – STANGMMX Jan 02 '16 at 20:40
  • Have you tried today? I have been working with GC API for last couple months, and suddenly today all the issues I have with GC starting to work properly. – user523234 Jan 12 '16 at 03:36
  • @user523234, no I haven't. And it actually does go through periods where it works as expected but, not for long. – STANGMMX Jan 12 '16 at 18:15
  • @user523234 I was having an issue where I wasn't receiving push notifications from `endTurnWithNextParticipants` and after reading your comment I just tried it today and it works. – knubie Jan 13 '16 at 15:43
  • Did you find the cause for the "The connection to service named com.apple.gamed ...". Any clue what the message means? – Fredrik Johansson May 19 '16 at 19:06
  • @FredrikJohansson nope. I ended up removing GameKit entirely. – STANGMMX Aug 18 '16 at 15:15

1 Answers1

0

Exchanges has until Oct 2020 never actually worked as needed, nor as specified, due to a bug in the Apple backend. Now however, an Apple engineer seem to suggest it has been fixed - asking me to verify that it works. Which I intend to do ASAP (I just need to update Xcode) using my public project: https://github.com/Gatada/TurnBasedGameFlow

FURTHER DETAIL

A turn based exchange relies on the turn holder being notified when the exchange is completed, so the turn holder can resolve it (submit it to Game Center). This notification however, was never pushed to the turn holder.

As a result of this bug, the games we made had to rely on the turn holder re-loading the game after the exchange completes, and our code had to gracefully handle the turn submission failing due to game data being out-of-sync (caused by the completed exchange).

I had a one-on-one Game Center session with Apple during WWDC 2020, where I reported this issue with hard evidence (after all, this bug had been around since 2010) which convinced the Apple engineer. It took them 3 months to get back to me, and another 3 months for me to get back to them - hehe, bringing us to now.

Johan
  • 2,472
  • 1
  • 23
  • 25