Troubleshooting
What to check when a device doesn't register or a push doesn't show, and where the SDK's own messages go.
Start with diagnostics
Print what the SDK knows about this install:
print(await Pushwren.diagnostics())
It shows the device ID, the token, the environment (sandbox or production), the notification permission, the API host, the last sync and the last error, including a change the server refused.
Where the SDK’s messages go
The SDK writes its messages (“Registered device…”, dropped changes, errors) to Apple’s unified log under the subsystem com.pushwren.sdk. Xcode’s console shows them only for an app Xcode launched. For an app started from the home screen:
- iPhone: open Console on your Mac, select the connected iPhone, start streaming, and search for
subsystem:com.pushwren.sdk. - Simulator:
xcrun simctl spawn booted log stream --predicate 'subsystem == "com.pushwren.sdk"' --level info
Set Pushwren.logLevel to .error for fewer messages, or .off for none.
What you see, and the likely cause
| What you see | Likely cause |
|---|---|
The log says registering failed: no valid "aps-environment" entitlement string found |
The Push Notifications capability is missing, or the provisioning profile predates it. Add it and rebuild. |
The build fails: Provisioning profile … doesn't include the aps-environment entitlement |
The profile was made before you added Push Notifications. With automatic signing, Xcode makes a new one; from the command line, build with -allowProvisioningUpdates while signed in to Xcode. |
| No token, and the device never appears in the portal | Check diagnostics() for a registration error. On some iOS versions the token waits for the user to allow notifications. Simulators register only on some Macs, so try a real device. |
The portal shows the push as accepted, but nothing appeared |
Apple accepted it, but Apple never confirms that a device showed a push. Check the device’s environment and last-seen time in the portal, and that notifications are allowed for the app. |
| The image doesn’t show, but the notification does | The image URL isn’t https or public, the file isn’t JPEG, PNG or GIF, it is over 10 MB, or it didn’t download in the time iOS gives an extension. The app also needs the extension target with PushwrenNotificationService. See Images and delivery receipts. |
| Delivered stays at zero, or is lower than you expect | Delivered is a lower bound. Only alert pushes to devices whose app has the helper are asked, a send to over about 1,000 devices asks a sample, and a receipt the phone couldn’t post isn’t retried. Check the portal’s device page for “Delivery receipts: on”. |
invalid_user_signature in diagnostics() |
Identity verification is on and the user ID had no valid signature. See Identity verification. |
Pushwren.configure needs a publishable key in the log |
The key isn’t a pk_… key. Never ship a secret key (sk_…) in an app. |
The device is registered, but pushes fail with BadDeviceToken |
The build and the key’s environment don’t match. Xcode debug builds use sandbox; TestFlight and App Store builds use production. The portal’s notification detail explains each failure, and so does Delivery failures. |
Pushes arrive, but taps aren’t counted or Pushwren.opens is silent |
Something else is the notification center’s delegate, and it doesn’t forward Pushwren.didReceive(response:). See If your app already has an app delegate. |
| Nothing shows while the app is open | That’s iOS’s default. PushwrenAppDelegate shows a banner; your own delegate needs willPresent. See If your app already has an app delegate. |
Still stuck
Email hello@pushwren.com with the device ID from diagnostics() and the notification ID from the portal or the API.