Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

no valid “aps-environment” entitlement string found for application error when implementing FCM

When attempting to implement Firebase Cloud Messaging into my application, I am receiving the following error at runtime:

[Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: no valid "aps-environment" entitlement string found for application

I am receiving an FCM token, so it appears to be establishing a connection with firebase. I have read many suggestions on what the problem could be, many seem to indicate that there is a problem with my provisioning profile not allowing push notifications. I have checked these settings under "Signing & Capabilities" and it appears that the profile allows for push notifications, and has the aps-environment value in the entitlements section:

Text

Is there something else I'm missing?

Here is my development environment:

  • macOS 10.15 (Catalina)
  • Xcode 11.5
  • iPad Air 2 (test deployment device)
like image 897
kaht Avatar asked Dec 14 '22 08:12

kaht


1 Answers

I finally found the answer. Although my provisioning profile states that I have the aps-environment entitlement, and that I have Push Notification capability included, I STILL had to enable push notifications manually in the project. Additionally, the Background Modes (Remote notifications) capability needed to be added as well. These menus have changed in recent versions of xcode (for instance, the capabilities menu is now called signing and capabilities, and the add capability button is nestled up above all the settings).

In Xcode 11.5, follow these steps:

  1. Click on your workspace name
  2. Select your project in the target list
  3. Select Signing & Capabilities
  4. Click the +Capability button
  5. Add Push Notifications and Background Modes (Remote notifications) from the list.

Steps to add capabilities

like image 166
kaht Avatar answered Jan 19 '23 00:01

kaht