How do I reply to a GKTurnBasedExchange? GKLocalPlayerListener delegate receivedExchangeReplies is called intermittently

余生颓废 提交于 2019-12-19 10:23:07

问题


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.

来源:https://stackoverflow.com/questions/34570404/how-do-i-reply-to-a-gkturnbasedexchange-gklocalplayerlistener-delegate-received

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!