No push notifications on iOS - SDK 36

Please provide the following:

  1. SDK Version: 36.0.0
  2. Platforms(Android/iOS/web/all): iOS, Android.

I am working on an App and I have gotten the push notifications to work on Android, but I am not getting anything on iOS at all. No notification when the app is closed, or when the app is open (even with:

"notification": {
      "iosDisplayInForeground": true
    }

in app.json)

I have looked at this post, and tried the example snack that was listed there by one of the expo team members, which didn’t send any information to the iPhone device either. No notification, no origin, no data, nothing - but it works fine on two different Android devices I have tested on.

I saw in this post: Push Notifications not working on iOS that the same Expo team member said something about bundleIdentifier and changing it. I tried to play around with expo credentials:manager but was not sure what to do. Must I link my app to the App Store before I can get Push notifications on iOS?

On the notification receipt I get

{
    "data": {
        "status": "ok",
        "id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    }
}

Hi @akumau1. Are you using a real device or a simulator (you cannot receive then if i am not mistaken). If you are using a real device, check if the Do not disturb mode is not activated.

Hi @ceessay, I am using a physical device. I checked that the Do not disturb mode is switched off.

Are notifications authorized for the expo app in your settings @akumau1 ?

Yes. I have switched the notification permissions off and back on again to see if that was the problem, but still no success. I am going to try on another device soon - as it might be the device itself, and nothing in the code. Hopefully that is the case.

Do you have any other suggestions that I can try?

Well, in order to confirm that it is a device issue, maybe you can try programmatically logging the received notifications using the Notification API. Basically you just add a notification listener on your app and pass a listener function to it. I made a snack to help

TO test it you can use the Push notification tool https://expo.io/notifications

1 Like

Thanks for the effort! Tried the snack on my phone, and got the following in the logs:

did mount
U1’s iPhone: pushNotifToken is ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]
did mount
U1’s iPhone: pushNotifToken is ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]

But no other console.log ran. It never get’s to the listener. Does that mean it’s my phone? I’ll have to try and use a different iPhone then. :slightly_frowning_face:

Did you send a push notification using the PN tool here: https://expo.io/notifications ?

Have a try without running your app. If you dont receive a pushnote on your device check if notifications are allowed on your iphone ( settings - notifications - expo).
You only need a listener in your app if you want to handle the pushnote in your app.
I only wonder that it does not work on android with a channel.

I did. I used that tool. It works on my Android device, but not on the iPhone.

I was looking at the Expo Documentation and found this paragraph on the App Signing page:

Apple Push Notification Keys (often abbreviated as APN keys) allow the associated apps to send and receive push notifications. By default, any app built with Expo will require an APN key. This is so that you can enable push notifications for your app through a quick OTA update, rather than needing to submit an entirely new binary.

Does this mean I need to somehow link my Apple developer account with my Expo account before I can get Push notifications on my iPhone? As of yet I have not published the app, or created a build. I am just running my app on the Expo Client through running expo start.

I will be testing the Push Notifications sometime later today on a friend’s phone. Hopefully it get’s resolved there and I can come back and share the good news!

I have tried closing the Expo app (double tapping the Home button on the phone and swiping up) and then sending a Push Notification (using the Expo PN Tool) - and then not receiving anything, as well as trying to just go out of the app, and sending a PN. Nothing seems to work :sob: .

@ceessay wrote a nice little snack in one of the above replies that enables a listener. The snack works and console.logs the correct information on my Android device, but it doesn’t do anything on the iPhone. This is why I am wondering if I must set up anything else for iPhone to get it to work.

Did you check the settings at your iphone as I described?

And not to forget: every time you installed expo new you get a new push token!

I did check. Here is a screenshot from my Expo settings.

In response to the other message: I print out my token I get from token = await Notifications.getExpoPushTokenAsync() in the console every time I launch the app from Expo Client to make sure I’m using the correct one.

Same settings as me.
No more idea. Would you like to write an email direkt outside of the forum? I could send my pushtoken to you and you could try sending a pushnote via https://expo.io/notifications and vice versa if you want to?

You do not need to have any link to your developper account (i don’t have any) and if i am not mistaken, the app signing process is only required when you are ready to go to the store and is done automatically on Expo servers. Wow man this is tough :grimacing: . I cannot see any reason why is is not working. Maybe trying to borrow another iPhone to test an if it works or uninstalling the Expo client, restarting your iPhone and reinstalling it again. You can also check the expo Slack channel for further help: expo-developers.slack.com

My physical android devices and physical iPads was working fine with notification, until now, only androids still working and I did not change any code that related to notification configuration. (I tested with 3 android devices and 2 iPad) Seems like registering token on iOS has some issues with SDK 36 right now. Also, they all are working when testing via expo client (expo start) but not the built version (expo build)

PS, my app that built with previous SDK still be able to register new token and working fine.

@poonsakn @hajo0950 @ceessay
I have tested my app and the notification functionality on another friend’s iPhone and all seems to work fine on his device. I tried to uninstall, restart, re-install Expo client. Didn’t seem to help.

Next step is to maybe try factory reset my phone after doing some backups.

One thing to be aware of is that the push notification token that identifies the device for you to send push notifications to can change. You can’t rely on it being stable. So it’s entirely possible that the device you are using has a different token than it did last week.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.