fix(ios): inject aps-environment entitlement so APNs push registration works
The @capacitor/push-notifications plugin does not add the Push Notifications capability to the CI-generated Xcode project (that's a manual Xcode step), and add-share-extension.rb only merged the App Group into App.entitlements, assuming aps-environment was already there. It never was — so on device PushNotifications. register() failed with 'no valid aps-environment entitlement', no APNs token was obtained, and device_tokens stayed empty (server had nothing to push to). ios-patch.sh now creates App/App.entitlements with aps-environment=production before the share-extension script merges the App Group in. Still requires the App ID to have Push Notifications enabled (so the profile carries the entitlement) and the server APNS_* key set (Step 5) for end-to-end delivery. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+11
-1
@@ -40,7 +40,17 @@ On the **Register an App ID** page, only three fields matter — leave everythin
|
||||
- Add yourself under **TestFlight → Internal Testing** to install via the TestFlight app on your iPhone.
|
||||
|
||||
## Step 5 — Push notifications (APNs) — do this once, then tell me
|
||||
So the app gets **calls/messages while it's closed**:
|
||||
So the app gets **calls/messages while it's closed**. Two independent pieces must BOTH be in place:
|
||||
|
||||
> **A. App ID capability (client side).** The App ID `com.bizgaze.connect` must have **Push Notifications**
|
||||
> enabled (Step 0 ticks it). The build now injects the `aps-environment` entitlement automatically
|
||||
> (`ios-patch.sh`), so the app can obtain an APNs token — but if the App ID lacks the Push capability, the
|
||||
> archive fails code-signing on `aps-environment`. If a build errors on that after you enable the
|
||||
> capability, delete the app's provisioning profile in App Store Connect so the next Codemagic run
|
||||
> regenerates one that includes push.
|
||||
>
|
||||
> **B. APNs key (server side).** Do the two steps below so the server can actually SEND to that token.
|
||||
|
||||
1. developer.apple.com → **Keys → +** → enable **Apple Push Notifications service (APNs)** → download the
|
||||
**`.p8`**. Note its **Key ID** and your **Team ID** (top-right of the developer portal).
|
||||
2. **Send me**: the `.p8` contents, the **Key ID**, and the **Team ID**. I set these in the server `.env`
|
||||
|
||||
Reference in New Issue
Block a user