Issue with APN entitlement on iOS - Xcode 15

I have been pulling out my hair the past day over this. I am adding push / remote notifications (using FCM) and running into an issue with the APN entitlement not being added to provisioning profile - using automatic signing. Now I am somewhat of a new / hobbyist developer but I'm sure I've covered all the bases: Have added (and removed and re-added) the capability in Xcode. Created (and recreated) the APN key in the developer portal (combined with Sign in with Apple) AppDelegate is fine FCM returns a device key without issue. Cleaned build folder and rebuilt app

Despite this I am still getting "10.18.0 [FirebaseMessaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: no valid *aps-environment" entitlement string found for application" error.

Include is a screen capture of the automatically generated profile which seems to illustrate the issue.

Any and all advice is greatly appreciated ;)

My general advice for this is to build your app for the device and then dump the entitlements authorised by your provisioning profile and the entitlements claimed by the app. That lets you determine whether the problem is the way that your app is built or something that’s happening at runtime.

To dump the profile of a built app:

% security cms -D -i /path/to/your.app/embedded.mobileprovision

To dump the entitlements of a built app:

% codesign -d --entitlements - /path/to/your.app

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I'm experiencing the same thing. When I run the security cms -D -i /path/to/your.app/embedded.mobileprovision command I see

  <key>Entitlements</key>
  <dict>
    <key>aps-environment</key>
 	<string>development</string>
  ...

However, running the codesign -d --entitlements - /path/to/your.app command, there is no aps-environment Key. Just to be sure I was looking for the right thing, I ran the code sign command on another app that has Push Notifications working, and the aps-environment Key is present there.

It seems that something in the build process is causing this issue. Now to dig into that to see if anything sticks out.

Following up - While the "Automatically manage signing" option is enabled in Xcode, I did have a provisioning profile for this app in developer.apple.com that was generated before I enabled Push Notifications. I deleted that profile and created a new one now that Push Notifications are part of the app, toggled Automatically manage signing off and then back on, and the next time I built the app, the aps-environment issue was resolved and a push token was available. Hmm.

Issue with APN entitlement on iOS - Xcode 15
 
 
Q