Google Cloud Messaging shows “notRegistered” when

2019-05-11 19:38发布

I have implemented a GCM service on an iOS app. I use PHP to send GCM at the server. It works perfectly when the app is signed by a development provisioning profile.

That is, when the app registers itself using the GCM Config, it always returns a functioning device token. I can send a notification to the device using the token without any error.

But after I sign the app by distributed provisioning profile and test the app by TestFlight or Ad Hoc Provisioning, I received a "Not Registered" error.

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

How does it happen? Any Solution? I have checked that I enabled APNS in both development and distribution provisioning profile.

I did not enable TLS on my server. Actually my SSL Cert is not ready so I can't test it. Is this the reason?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-05-11 20:13

Are you setting the kGGLInstanceIDAPNSServerTypeSandboxOption to NO when you build your app for Distribution?

Your APNS token is being rejected by APNS server and that's when GCM unregisters the GCM registration token for your app and you start seeing the NotRegistered error.

Here is the documentation for the flag.

查看更多
登录 后发表回答