High-Level Problem
After upgrading to IOS 13 and installing the latest version of our app from the app store, we stopped receiving push notifications.
Details
Our app is generating push notification device tokens by calling Notifications.getExpoPushTokenAsync() which we then store in our database for later reference.
This problem occurs when using the Expo Push Notification Tool as well.
When I retrieve the push notification receipt, it contains the following: {"status":"error","message":"The Apple Push Notification service failed to send the notification (reason: BadDeviceToken, status code: 400). Read Apple's docs about \"Communicating with APNs\" to learn what this error means.","details":{"apns":{"reason":"BadDeviceToken","statusCode":400},"sentAt":1569011007},"__debug":{}}}}
When loading the app from the Expo CLI, we receive push notifications just fine.
It looks like some problem with iOS 13. Not sure if just for the beta or the production build as well. I’m using 13.1 beta 4 and having the same problems. The notifications are being received in my iPad using iOS 11.
I created a topic a few minutes before you reporting the same problem:
It’s looking like it is not just the beta. There was a breaking change in iOS 13 that affects all existing apps. The fix is to upgrade to SDK 35, rebuild your app binary, and resubmit to the App Store. We are also looking into back-porting the fix to the SDK 34 builders, in which case you will need to rebuild your app binary and resubmit to the App Store but not upgrade your SDK version if you’re already on 34.
@ide can you elaborate on a bit on the fix? Is this something in Expo’s RN fork or another component? I’m wondering what we need to update in ExpoKit apps in order to fix this. Thanks!
Thanks for the info! Heads up for anyone else dealing with this that we ended up copying in the latest version of the file (expo/NSData+EXRemoteNotifications.m at master · expo/expo · GitHub), as it also incorporated making the token lowercase, which was necessary for our older APNS server-side library.
For anyone on ExpoKit not ready to upgrade to SDK 35, but wanting to make patching of this file more automatic in a patch-package-style solution, what we ended up doing was putting the updated code in a .fixed file in our project, and then copying it over the file in the ExpoKit cocoapod using a shell command in the post_install do |installer| block of Podfile: