简体   繁体   English

iOS推送通知不适用于开发证书

[英]iOS Push Notifications not working with Development certificate

Situation: we have PROD and DEV APN certificates installed on different backend URLs. 情况:我们在不同的后端URL上安装了PROD和DEV APN证书。 PRODUCTION certificate works!: pushes are delivered. 生产证书有效!:推送已交付。

DEV certificate does not work, apple servers return error code 7 (invalid token). DEV证书不起作用,Apple服务器返回错误代码7(无效令牌)。 I have already checked all the stuff but may be I'm still missing something. 我已经检查了所有的东西,但可能是我还在遗漏一些东西。

  • app id is correct (same used for prod) app id是正确的(同样用于prod)
  • i use right backend (with DEV certificate installed) 我使用右后端(已安装DEV证书)
  • I start the app from XCode in DEBUG mode (corresponds to DEV environment) 我在DEBUG模式下从XCode启动应用程序(对应于DEV环境)
  • I use proper app development certificate, from the same account 我使用适当的应用程序开发证书,来自同一个帐户
  • I use proper dev profile (pushes are supported in it) 我使用正确的dev配置文件(支持推送)

Should actually work, right? 应该真的有用,对吧?

In case of IOS 9, please send notifications from Apple Production Push notification certificate, it will work. 如果是IOS 9,请从Apple Production Push通知证书发送通知,它会起作用。

Make pem file from Production APS certificate, and use this file both in development as well as production mode. 从Production APS证书制作pem文件,并在开发和生产模式下使用此文件。

Moreover, use gateway of production in both cases which is "gateway.push.apple.com:2195" 此外,在“gateway.push.apple.com:2195”两种情况下都使用生产网关

Don't use "gateway.sandbox.push.apple.com:2195" even if you are sending notifications in development mode. 即使您在开发模式下发送通知,也不要使用“gateway.sandbox.push.apple.com:2195”。

The device token returned by the phone for push notifications is different in production and development. 电话为推送通知返回的设备令牌在生产和开发方面有所不同。 Make sure that your server uses an actual development device token (I'm not talking about the certificate but about the device identifier) when making a request to APNS. 在向APNS发出请求时,请确保您的服务器使用实际的开发设备令牌(我不是在谈论证书而是关于设备标识符)。

If your device already run the production build of your app, the production token may be in your database and your server may try to use it. 如果您的设备已经运行了应用程序的生产版本,则生产令牌可能位于您的数据库中,您的服务器可能会尝试使用它。 Depends on how you handled your user accounts though. 取决于您如何处理您的用户帐户。

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

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