[iOS] Push Notifications with Safari APN not being sent #129
-
Hi, I've done everything from ios mobile push documentation When I log in to app with user xyz@xyz.com, I send device token to MagicBell. In MagicBell token is correctly added to user (it appears on user push subscriptions list) When I try to sent notification to this user logged on iOS nothing happens - in logs there is no event "mobile_push". When I send notification to iOS directly from APN via CloudKit Console I can see notifications in my app. Everything was tested on real devices, not simulators. It seems to me that the certificates are fine and the handling of notifications in the application too (because I can see notifications from the APN). So I think that the problem is somewhere between MagicBell and APN. Do you have any idea where? "react-native": "0.71.8", |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hey @AgnieszkaMlynska do you see any errors in the Logs screen? |
Beta Was this translation helpful? Give feedback.
-
Hi @unamashana,
Unfortunately not, there is no error.
Here are the steps:
1. Open my app and log in (after logging in I send device token to
MagicBell) - example user xyz@xyz.com
2. Open MagicBell dashboard
3. Check if device token from app is on user push subscriptions list
(Users->my user->push subscriptions list on the right) - it is
4. Go to compose.
5. Fill the form (user/recipient xyz@xyz.com) and send
6. Go to notifications list -> there is notification with one recipient,
status sent
7. Go to logs -> there is no mobile_push event
Notifications and Logs sections which I check are on the MagicBell console.
Maybe something is wrong with my p8 certificate (added in
Settings->Channels->Mobile Push->Safari APNs). What format should this
certificate have?
Should it contain spaces, "-----BEGIN PRIVATE KEY-----" etc?
|
Beta Was this translation helpful? Give feedback.
-
Hi @unamashana, do you have any update about that problem? |
Beta Was this translation helpful? Give feedback.
-
With @unamashana help I was able to make it work. The problem was in Safari APNs configuration. When you install your app in debug mode and send notification via MagicBell dashboard you should now see event in logs with message "BadDeviceToken". MagicBell environment doesn't match with your app environment so it cannot send notifications. |
Beta Was this translation helpful? Give feedback.
With @unamashana help I was able to make it work.
Notifications are being send via APN.
The problem was in Safari APNs configuration.
p8 certificate should have format like "-----BEGIN PRIVATE KEY----- key -----END PRIVATE KEY-----" and environment should be set to "production".
When you install your app in debug mode and send notification via MagicBell dashboard you should now see event in logs with message "BadDeviceToken". MagicBell environment doesn't match with your app environment so it cannot send notifications.
When you have app installed from Testflight (environment here is production) everything work and notifications are delivered to phones.