Google推送通知不适用于制作

我得到这个错误在IOS谷歌推送通知

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

我在开发环境和生产环境中获得注册ID。

发展环境的信息:

{"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"}]} 

并没有收到通知。

我已经尝试了从吊销证书和创build新的证书和新的供应configuration文件到清洁构build文件夹的每一件事情,但通知仍然没有生产。

对我来说,解决scheme是我必须去AppDelegate.swift文件,并在开发中searchkGGLInstanceIDAPNSServerTypeSandboxOption它应该是真实的,对于生产它应该是错误的。 只是将其更改为虚假生产和通知正在为我工​​作。

你可以这样做生产环境:

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