谷歌推送通知在生产中不起作用 [英] Google push notification not working in production

查看:30
本文介绍了谷歌推送通知在生产中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IOS 谷歌推送通知上收到此错误

I am getting this error on IOS google push notification

无法完成操作.(com.google.gcm 错误 501.)

The operation couldn’t be completed. (com.google.gcm error 501.)

我在开发环境和生产环境中获得了注册id.

I get the registration id in development environment and production environment.

开发环境的信息:

{"multicast_id":8145067860904395870,"success":1,"failure":0,"canonical_ids":0,"results":
[{"message_id":"0:1452842547360715%bc92eed1bc92eed1"}]}

然后我成功收到消息.

但在生产环境中我收到此消息.

{"multicast_id":8861850059359760561,"success":0,"failure":1,"canonical_ids":0,"results":
[{"error":"NotRegistered"}]}

并且没有收到通知.

我已经尝试了从吊销证书、创建新证书和新配置文件到清理构建文件夹的所有方法,但通知在生产中仍然不起作用.

I have tried every thing from revoking certificate and creating new certificate and new provisioning profile to cleaning build folder but notification is still not working in production.

推荐答案

您可以在生产环境中这样做.:

You can do it like this for production environment.:

GGLInstanceID.sharedInstance().startWithConfig(instanceIDConfig)
    registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken,
                           kGGLInstanceIDAPNSServerTypeSandboxOption:false]
    GGLInstanceID.sharedInstance().tokenWithAuthorizedEntity(gcmSenderID,
                                                             scope: kGGLInstanceIDScopeGCM, options: registrationOptions, handler: registrationHandler)

这篇关于谷歌推送通知在生产中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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