How do I get notifications for GameKit Turn-Based matches?

前端 未结 4 594
小蘑菇
小蘑菇 2020-12-31 11:29

I\'m working on a turn based iOS game using the new turn-based iOS5 API.

One of the delegate protocols you need to implement for this is GKTurnBasedEventHandlerDele

相关标签:
4条回答
  • 2020-12-31 11:46

    Have you set push notifications up in iTunes connect / the provisioning portal? You actually need a special certificate to enable push.

    I was having the same problem as you until I set up the certificates.

    0 讨论(0)
  • 2020-12-31 11:54

    As the documentation says, that message is received when the player has accepted the push notification (typically by unlocking the phone or via notification center). Sending push notifications is decided in Game Center client-side, and automatically done for you by GameKit. You don't need to implement a GKTurnBasedEventHandlerDelegate in order for them to work, only to respond to the player accepting them (by automatically returning to that match or whatever).

    I guess it's worth double checking in your device's Notification settings to see that your app has Notification Center alerts enabled.

    0 讨论(0)
  • 2020-12-31 12:00

    I just finished fighting my way through this, and after a week or so of banging my head against the desk I discovered these important things:

    (1) The simulator does not receive these turn notifications. Once I made this work, it works fine between two devices. A simulator playing versus a device will send events, but not receive them. So if you are trying to use one device and the simulator to test this, good luck. Use two devices.

    (2) Make sure that you have "Game Center Enabled for this Version" turned on in iTunes connect, and make sure that the CFBundleVersion in your app matches this version. As soon as I did this, everything started working.

    I assume you have already done: [GKTurnBasedEventHandler sharedTurnBasedEventHandler].delegate = YOUR_DELEGATE_CLASS;

    0 讨论(0)
  • 2020-12-31 12:03

    Tom Schulz said true. But one thing! : you can get notifications with your device but not with simulator . To do this always reset your simulator content and settings before build and run . And on the simulator you can use load matches method to receive something for tests. Hope it helps

    0 讨论(0)
提交回复
热议问题