简体   繁体   English

GCM iOS Production未收到通知

[英]GCM iOS Production not receiving notifications

So, I have a problem with GCM. 所以,我对GCM有疑问。 I have uploaded .p12 development and production APNS certificates to Google Console (I've checked, they are the same name, bundle identifier). 我已将.p12开发和生产APNS证书上传到Google控制台(我已经检查过,它们是同一个名称,包标识符)。 I have my development and production provision profile all set up. 我已经设置了我的开发和生产配置文件。 I have aps-environment in my production profile and I am able to upload normally to iTunes Connect. 我的生产配置文件中有aps-environment ,我可以正常上传到iTunes Connect。 I am using: 我在用:

    _registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                    kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};

for production. 用于生产。 It is set to NO. 它被设置为NO。 For my development it is set to YES. 对于我的开发,它设置为YES。 I've checked, I am getting device token, and it is sent to my server. 我已经检查过,我正在获取设备令牌,并将其发送到我的服务器。

Push notifications are just not working in Production environment. 推送通知在生产环境中无效。 They only work in Development environment. 他们只在开发环境中工作。 Do you have any idea what's the cause? 你知道原因是什么吗?

Set "priority": "high" 设置"priority": "high"

{
      "to": "gcm_device_token",
      "priority": "high",
      "content_available": false,
      "notification": {
        "sound": "default",
        "badge": "1",
        "title": "Push Title",
        "body": "Push Body"
      }
    }

Here's the code to use for production environment : 这是用于生产环境的代码:

_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                         kGGLInstanceIDAPNSServerTypeSandboxOption:@NO};

Here's the code to use for development environment : 这是用于开发环境的代码:

_registrationOptions = @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
                         kGGLInstanceIDAPNSServerTypeSandboxOption:@YES};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM