When building a React Native Expo app using Expo Application Services (EAS) for iOS, you might encounter a "Push notifications capability is missing" error if your app requires the use of push notifications, but the required capability is not configured in your Xcode project.
To resolve this error and enable push notifications for your Expo EAS-built iOS app, follow these steps:
Configure Push Notifications in your Expo app: Before building your iOS app, make sure you have properly configured push notifications in your Expo project. You can do this by following the official Expo documentation on push notifications:
Add Push Notifications Capability in Xcode: After configuring push notifications in your Expo project, you need to enable the "Push Notifications" capability in your Xcode project.
Open your Xcode project by running the following command in your project's root directory:bash
This command will trigger the EAS build process, and at some point, it will open your Xcode project in Xcode.
In Xcode, navigate to the project settings by selecting the root node in the Project Navigator and then selecting your target in the Targets section.
Select the "Signing & Capabilities" tab, and click the "+" button to add a new capability.
Search for "Push Notifications" and add it to your target.
Configure Push Notifications Entitlements: With the "Push Notifications" capability added, Xcode will automatically create an entitlements file (if not already present) and enable the necessary background modes for push notifications.
Save Changes and Rebuild: After adding the "Push Notifications" capability and configuring the entitlements, save your changes in Xcode and close the project.
Now, you can trigger the EAS build process again by running:bash
The updated Xcode project with the "Push Notifications" capability will be used for the build.
Test Push Notifications on a Real Device: After successfully building the app with the push notifications capability, you can test push notifications on a real iOS device. You will need to handle push notifications differently on iOS compared to Android.
Remember that for Expo apps, push notifications require additional setup in both your Expo project and the native Xcode project. Ensure that you have followed the necessary steps for Expo push notifications, as well as enabling the required capabilities in Xcode for successful EAS builds with push notifications support on iOS.