问题
Im trying to send VoIP notifications via PushKit, but in Production(Distribution) environment, I get "Invalid Token" from server.
everything works fine in development env with same certificate and url:ssl://gateway.sandbox.push.apple.com
with port:2195
but when i change the url to:ssl://gateway.push.apple.com
, I get "Invalid Token" error with no extra data
回答1:
Looks like you are using same Voip device token generated by Client in sandbox environment for both sandbox as well as production. That's the reason you will get invalid token error.
This will not work. If you want to use production environment, you need to make sure your client/app is creating device token in production environment. (You can not use device token generated by client using Sandbox when your server is using production environment)
Pl. note separate device tokens are generated for sandbox/production environment for the same app/client on the same device. Hope it helps.
来源:https://stackoverflow.com/questions/44860641/invalid-token-while-sending-pushkit-notification-in-production-environment