Expo push notifications not working on production on App Store

SDK Version: 40.0.0
Platform: iOS

So I’m using expo-notifications for notifications on my expo app and when I run it through the Expo Client app on my iPhone, the token I get works perfectly and I’m able to send push notifications using both the expo push notifications tool and through the app. However, when I deployed my app to the App Store, the token I’m getting (I’m storing it in firebase to be used when the user needs to be notified) doesn’t work for sending push notifications. Furthermore, it doesn’t ask me for permission to send push notifications, and when you go to Settings → [My app name], settings appear for Location, Camera, Siri & Search, and Cellular Data, but not Notifications like some of the other apps I have on my phone.

I took the token from firebase and ran the following code to see if it would work if I sent it in a node script:

const testPush = async () => {
    var pMessages = [];
    const pushToken = "ExponentPushToken[######################]"; // coming from firebase 
    pMessages.push({
        to: pushToken,
        sound: 'default',
        title: 'Test Title',
        body: 'Test Body',
        badge: 1
    })
    let returnCode = await expo.sendPushNotificationsAsync(pMessages);
    console.log(returnCode);
}

And this is what I get:

[ { status: 'ok', id: 'aabbccdd' } ]

(I don’t know if the id value is sensitive or not, but I’m censoring it anyways. When running this I copy-pasted it into the spot where aabbccdd appears again)
I also remember seeing some things about checking the receipts, so I tried that as well with the following code

const fetchReceipts = async () => {
    const response = await timeout(TIMEOUT_TIME,
        fetch('https://exp.host/--/api/v2/push/getReceipts', {
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Accept-Encoding': 'gzip, deflate',
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                ids: [
                    'aabbccdd',
                ]
            })
        }));
    console.log('RESPONSE: ');
    console.log(response);

    console.log('RESDATA: ');
    const resData = await response.json();
    console.log(resData);
}

And this is the output:

RESPONSE: 
Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: PassThrough {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      [Symbol(kCapture)]: false,
      [Symbol(kTransformState)]: [Object]
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://exp.host/--/api/v2/push/getReceipts',
    status: 200,
    statusText: 'OK',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}
RESDATA: 
{ data: { 'aabbccdd': { status: 'ok' } } }

I also used “expo build:ios --clear-push-cert” to generate the build that I submitted to the App Store.
Based on what I’ve read on forums and StackOverflow, it seems that the p8 file is important and I saw people talking about uploading it to expo but I have no idea how to do that, but I was able to generate one and I have it saved on my computer. I’m guessing that’s the problem, so if anyone knows how I can set up notifications properly using the p8, or if anyone has any ideas on what steps I’m missing that’s preventing this from working; any insight or help is greatly appreciated!

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