iOS - 我需要在应用功能下启用推送通知吗?

iOS - Do I need to enable push notifications under app capabilities?

我使用本指南在我的 iPhone 应用中使用了 Firebase 推送通知服务:https://firebase.google.com/docs/notifications/ios/console-audience?authuser=3 and it works great, I can send notifications when the app is running on a device. But do I need to enable the push notifications capability under capabilities in Xcode? see attached image.

是的。您需要在“功能”选项卡 中打开“推送通知”。功能是系统需要了解您的应用程序的内容。除非正确设置匹配功能,否则某些 API(例如接收推送或播放背景音频)将无法正常工作。

Apple Push Notification service (APNs) allows an app that isn’t running in the foreground to notify the user that it has information for the user. Use Xcode to enable push notifications. If necessary, Xcode creates an explicit App ID with the APNs entitlement enabled and a team provisioning profile using the explicit App ID. You then generate and download a corresponding client SSL certificate—this step fully enables push notifications—and later, install the client SSL certificate and key on your server.

有关更多信息,请访问 Apple Documents and APNS Dcouments