GKTurnBasedEventHandler委托未收到任何消息 [英] GKTurnBasedEventHandler delegate is not receiving any messages

查看:76
本文介绍了GKTurnBasedEventHandler委托未收到任何消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用过[[GKTurnBasedEventHandler sharedTurnBasedEventHandler] setDelegate:self];,但是我没有收到委托呼叫.这在某一点上是有效的,我无法确定我的一生发生了什么变化.

I have used [[GKTurnBasedEventHandler sharedTurnBasedEventHandler] setDelegate:self]; but I am not receiving delegate calls. This was working at one point, and I can't figure out for the life of me what has changed.

该应用已正确标记(在设备主屏幕上,它显示一个标记,其中包含轮到我玩的游戏数量).此外,使用GKTurnBasedMatch loadMatchesWithCompletionHandler:能够检测出玩家何时轮到(或不轮到).实际上,以其他所有可能的方式,GameCenter似乎都可以正常运行.我什至可以发送(并接受)质询,但是同样,不调用委托方法:没有调用任何GKTurnBasedEventHandlerDelegate方法(包括handleTurnEventForMatch:handleInviteFromGameCenter:等)

The app is properly badged (on the device home screen, it shows a badge with the number of games where it is my turn). Furthermore, using GKTurnBasedMatch loadMatchesWithCompletionHandler: is able to detect when it is the player's turn (or not). In fact, in every other conceivable way, GameCenter seems to be working perfectly. I can even send (and accept) challenges, but again, the delegate methods are not called: none of the GKTurnBasedEventHandlerDelegate methods are invoked (including handleTurnEventForMatch:, handleInviteFromGameCenter:, etc.)

它变得更加奇怪:如果我完全退出了该应用程序并且轮到我了,那么我将看不到任何GameCenter通知.但是,我不要在我的应用上设置徽章!如果我只是简单地打开GameCenter应用本身,那么我也该轮到我了.因此,即使服务器上的数据已正确更新,即使操作系统级别的通知也没有被接收到.

It gets even weirder: if I quit the app entirely and it becomes my turn, I don't see any GameCenter notification. However, I DO se a badge on my app! if I simply open the GameCenter app itself, I also see that it is my turn. So, even the OS-level notifications are not being received, despite the fact that the data is properly updated on the server...

我听说过,也许GameCenter Sandbox不能可靠地用于通知发送……但我真的不能冒险.我需要测试我的代码!

I've heard talk that maybe the GameCenter Sandbox is just unreliable with notification delivery... but I really can't take that risk. I need to test my code!

我尝试过的事情:

  1. 确保我在真实设备(没有模拟器)上进行测试.我已经在4种真实设备上进行了测试,包括iPhones + iPad和iOS6 + iOS7.
  2. 我每60秒执行一次NSAssert([GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate == self,以确保不丢失委托属性(针对以下问题:
  3. 检查iTunesConnect version与我在info.plist(0.0.1)中的CFBundleShortVersionString完全相同,并且iTunesConnect将GameCenter显示为已启用"游戏.我什至还将CFBundleVersion设置为相同的值,只是为了确保没有混淆的机会.
  4. 在第3步中使用版本号.我将它们分别设置为1.0.01.00.1,依此类推.我还用NSLog打印它们以确保它们已正确复制到应用中.
  5. 检查我是否正在使用从developer.apple.com下载的显式配置文件,并且XCode在Capabilities中所有GameCenter步骤旁边都显示选中标记. (例如,我使用团队";我已经登录到供应配置文件中心并创建了开发配置文件,下载了该文件,并在调试设置"的构建设置"中将其明确设置为我的Provisioning Profile. ).
  6. 明确请求推送通知权限.我能够成功检索(和使用)令牌,因此APN服务似乎没有问题.
  7. 我也尝试过...等待.我已经将调试器连接到了该设备.转弯过后10分钟以上,没有代表被击中(我正在使用断点来确定这一点).
  1. Ensured that I am testing on real devices (no simulators). I've tested on 4 real devices, including an iPhones+iPads and iOS6+iOS7.
  2. I am doing a NSAssert([GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate == self every 60 seconds to ensure that the delegate property is not lost (per this question: handleTurnEventForMatch:didBecomeActive: callbacks only arriving some of the time)
  3. Double checked that I have push notifications enabled for the app within Settings
  4. Checked that the iTunesConnect version is exactly equal to my CFBundleShortVersionString in info.plist (0.0.1) and that iTunesConnect shows GameCenter as "enabled" for the game. I even also set the CFBundleVersion to also be the same value, just to ensure that there was no chance of confusion.
  5. Playing with the version #s in step 3. I've set them each to be 1.0.0 and 1.0 and 0.1, etc. I also print them out with a NSLog to make sure that they are properly copied into the app.
  6. Checked that I'm using explicit provisioning profiles, downloaded from developer.apple.com, and that XCode shows checkmarks next to all of the GameCenter steps in Capabilities. (e.g., I am not using "teams"; I have logged into the provisioning profile center and created a Development profile, downloaded it, and explicitly set it to my Provisioning Profile in Build Settings for Debug mode).
  7. Explicitly requesting push notification permissions. I was able to successfully retrieve (and use) a token, so there seems to be no problem with the APN service.
  8. I've also tried simply... waiting. I have the debugger attached to the device whose turn it is becoming. 10+ minutes after the turn has been passed off, no delegate is hit (I'm using a breakpoint to determine this).


更新 这个问题很有趣:沙盒游戏中心的转向事件通知不一致 这导致我尝试使用[[GKLocalPlayer localPlayer] registerListener:self]而不是GKTurnBasedEventHandler委托方法.不幸的是,问题仍然没有解决.我什至尝试使用最低版本的SDK设置为7.0进行编译(因为这是增加了7个功能).


Update This question was interesting: Sandbox Game Center Turn Event Notifications Not Consistent It led me to attempt to use [[GKLocalPlayer localPlayer] registerListener:self] instead of the GKTurnBasedEventHandler delegate method. Unfortunately, the problem was still not fixed. I even tried compiling with the minimum version of the SDK set to 7.0 (since this is a 7+ feature addition).

推荐答案

我也遇到了同样的问题.我大约有25%的时间收到通知,但无法正确测试该应用程序.

I'm having the same problems as well. I'm getting notifications around ~ 25% of time and I can't test properly the app.

根据文档,iOS7不推荐使用GKTurnBasedEventHandler.如果这是真的-这可能是这些问题的原因吗?

According to the documentation, GKTurnBasedEventHandler is deprecated on iOS7. If this is true - could this be the reason for these issues?

https://developer.apple. com/library/ios/documentation/GameKit/Reference/GKTurnBasedEventHandler_Ref/Reference/Reference.html

这篇关于GKTurnBasedEventHandler委托未收到任何消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆