xcode iOS 中的开发和生产 SSL 证书有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35625883/
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-09-15 08:35:15  来源:igfitidea点击:

What is the difference between development and production SSL certificates in iOS?

iosxcodeapple-push-notifications

提问by fraxool

This is maybe a strange question but it is really confusing me. Why do we have to create a development and a production SSL certificate for push notifications in iOS? What is the difference between the development and the production certificates?

这可能是一个奇怪的问题,但它确实让我感到困惑。为什么我们必须为 iOS 中的推送通知创建开发和生产 SSL 证书?开发证书和生产证书有什么区别?

I am developing an iOS app with Push notifications (handled by a self-hosted Parse Server) and when I switch my environment from development to production (with a production certificate), I don't receive the push notifications anymore on my devices. Will it work once I upload this app to the app store (then, it will be in production)? Or can I "test" my production environment to be sure the notifications will work in my app once published on the app store?

我正在开发一个带有推送通知的 iOS 应用程序(由自托管的解析服务器处理),当我将环境从开发切换到生产(使用生产证书)时,我的设备上不再收到推送通知。一旦我将此应用程序上传到应用程序商店(然后,它将投入生产),它会起作用吗?或者我可以“测试”我的生产环境以确保通知在我的应用程序上发布后可以在我的应用程序中运行?

采纳答案by Pradeep K

Apple uses different servers for sending push notifications to development versions and app store versions of the app. The development version is called Sandbox. The iOS maintains persistent connection to the its push servers depending on whether its development version or production version. Based on which certificate your app is signed (Dev or App Store/Ad Hoc) it will create a persistent connection to the respective push server. Since the two servers are different they will need different SSL certificates to establish a secure connection to the server.

Apple 使用不同的服务器向应用程序的开发版本和应用商店版本发送推送通知。开发版本称为 Sandbox。iOS 与其推送服务器保持持久连接,具体取决于其开发版本还是生产版本。根据您的应用程序签署的证书(Dev 或 App Store/Ad Hoc),它将创建与相应推送服务器的持久连接。由于两台服务器不同,因此它们需要不同的 SSL 证书才能与服务器建立安全连接。

For more info refer:

有关更多信息,请参阅:

https://developer.apple.com/library/ios/technotes/tn2265/_index.html

https://developer.apple.com/library/ios/technotes/tn2265/_index.html

回答by bAthi

If you are testing a push notifications in your app that time you easily check through debugging mode for this purpose you need Development SSL certificate. If you uploaded the app into App Store that time you need to add Production SSL certificate (for live app push notifications purpose you want to add production SSl).

如果您当时正在您的应用程序中测试推送通知,您可以为此轻松检查调试模式,您需要开发 SSL 证书。如果您当时将应用上传到 App Store,则需要添加生产 SSL 证书(为了实时应用推送通知,您希望添加生产 SSl)。