ios Google Cloud Messaging (GCM) not receiving remote notifications

前端 未结 2 1409
我在风中等你
我在风中等你 2020-12-20 11:47

Problem:
iOS isn\'t receiving any remote notifications from GCM, but can\'t find any information relating to why this would be the case.
First time

相关标签:
2条回答
  • 2020-12-20 12:18

    The error 2001 you get is NOT kGGLInstanceIDOperationErrorCodeMissingKeyPair but rather kGCMServiceErrorCodeAlreadyConnected. The latter means that you're already connected to GCM. To better debug this I would try to send a display notification to the device token i.e. send this

    $post_json_encode = '{"notification":{"body":"' . $msg . '"},"to":"/topics/global"}';

    You should theoretically connect to GCM when your app is in the foreground and disconnect when you go to background. You can then reconnect again when you come to the foreground.

    The data payload and notification payload are both applicable on iOS & Android. On iOS the difference is that notification payload is sent through APNS while data payload is sent through GCM's own connection which is only there when app is in foreground. In Android notification payload is the new display notification stuff added recently.

    0 讨论(0)
  • 2020-12-20 12:35

    I was facing the same issue on iOS. Then I found the solution on PushBots website. It is working fine for me now.

    In XCode go to Targets > Build settings > Code Signing Identity and make sure it's not automatic and set to the profile matching certificate linked to the application ID for example

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