Search code examples
iosxcodefirebasefirebase-notifications

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


I used Firebase push notifications service in my iPhone app using this guide: 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.enter image description here


Solution

  • Yes. You need Push Notifications on in your Capabilities tab .Capabilities are things that the system needs to know about your app. Some APIs - like receiving push or doing background audio - won't work right unless the matching capabilities are set correctly.

    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.

    for more Information you can get in Apple Documents and APNS Dcouments