iOS APNS 开发 [沙箱] 与生产

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28554638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 04:51:29  来源:igfitidea点击:

iOS APNS Development [sandbox] vs Production

iospush-notificationapple-push-notificationsprovisioning-profilep12

提问by Eugene

Guys I'm having some trouble figuring out the key differences between the APNS (push notification) Developer (Sandbox) and Production modes. In particular I have the following questions:

伙计们,我在弄清楚 APNS(推送通知)开发人员(沙盒)和生产模式之间的主要区别时遇到了一些麻烦。特别是我有以下问题:

1) Can I launch an app on the app-store with Push Notifications that is only registered for the APNS Developer Certificate? Or do I need to use to use APNS Production for apps I want to launch on the app store?

1) 我可以在应用商店中启动一个只注册了 APNS 开发者证书的带有推送通知的应用吗?或者我是否需要使用 APNS Production 来处理我想在应用商店中启动的应用?

2) In general, what are the functional reasons other than "development on development APNS" and "production on production APNS" that would inform my decision. In particular why would I choose to implement an APNS Developer certificate for my app at all and why not just run everything on a Production push account?

2) 一般来说,除了“开发 APNS 上的开发”和“生产 APNS 上的生产”之外,还有哪些功能原因会影响我的决定。特别是为什么我会选择为我的应用程序实施 APNS 开发人员证书,为什么不只在生产推送帐户上运行所有内容?

Here's what Apple says on it's website but it doesn't get to the heart of my question:

这是Apple在其网站上所说的,但它没有触及我的问题的核心:

Development:Use the development environment for initial development and testing of the provider app. It provides the same set of services as the production environment, although with a smaller number of server units. The development environment also acts as a virtual device, enabling simulated end-to-end testing. You access the development environment at gateway.sandbox.push.apple.com, outbound TCP port 2195.

Production:Use the production environment when building the production version of the provider app. Apps using the production environment must meet Apple's reliability requirements.

开发:使用开发环境对提供者应用程序进行初始开发和测试。它提供与生产环境相同的服务集,但服务器单元数量较少。开发环境还充当虚拟设备,支持模拟端到端测试。您通过 gateway.sandbox.push.apple.com 访问开发环境,出站 TCP 端口 2195。

生产:在构建提供者应用程序的生产版本时使用生产环境。使用生产环境的应用必须满足苹果的可靠性要求。

采纳答案by dminones

If you want to post your app to the app store you will need to use a Production Provisioning Profile, therefore all notifications sent with APNS Developer Certificate will not arrive to your app signed with a Production Provisioning Profile.

如果您想将您的应用发布到应用商店,您将需要使用生产供应配置文件,因此所有通过 APNS 开发者证书发送的通知都不会到达您使用生产供应配置文件签名的应用。

Why not use only a production APNS certificate? Well you can do this but...

为什么不只使用生产 APNS 证书?好吧,您可以这样做,但是...

  • In order to test you will need to build your app with a Production Ad Hoc Provisioning Profile, this is a lot of extra work at compiling
  • Using a production cert in development, and therefore using an ad-hoc build, you cannot run with the debugger. Makes troubleshooting very painful.
  • Test notifications makes everything goes to production so you have to be extra careful
  • 为了进行测试,您需要使用 Production Ad Hoc Provisioning Profile 构建您的应用程序,这需要大量额外的编译工作
  • 在开发中使用生产证书,因此使用临时构建,您不能使用调试器运行。使故障排除非常痛苦。
  • 测试通知使一切都投入生产,因此您必须格外小心

回答by Terry Tan

dminones' answer is very accurate. I want to point out that you can now use production cert in development. The difference is that you will send to 'gateway.sandbox.push.apple.com' for development and 'gateway.push.apple.com' for production. I think the reason for separating sandbox and production is to avoid sending test push notifications to real users. Imagine you do blast notifications, all of your users will have the notification.

dminones 的回答非常准确。我想指出您现在可以在开发中使用生产证书。不同之处在于您将发送到“gateway.sandbox.push.apple.com”进行开发,发送到“gateway.push.apple.com”进行生产。我认为将沙箱和生产分开的原因是为了避免向真实用户发送测试推送通知。想象一下,你做爆炸通知,你的所有用户都会收到通知。