Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Not receiving Push Notifications on iOS #199

Closed
1 task done
craigwendel opened this issue Sep 25, 2023 · 8 comments
Closed
1 task done

[Bug]: Not receiving Push Notifications on iOS #199

craigwendel opened this issue Sep 25, 2023 · 8 comments

Comments

@craigwendel
Copy link

craigwendel commented Sep 25, 2023

What happened?

I followed this guide for setting up my project with OneSignal for notifications but I'm not receiving any notifications at all for my build I pushed to iOS. I feel like I set up everything correctly and have the correct .p8 certificate that's integrated with Expo and my developer account on Apple but I'm always seeing the same Failed error below. Anyone else run into any issues like this? I've tried working with the Support team at OneSignal but so far no luck and it's usually hours before they respond to my questions. Thanks again!

Screen Shot 2023-09-25 at 12 49 16 PM
Screen Shot 2023-09-25 at 12 55 38 PM

Steps to reproduce?

1. Install the Expo plugin as demonstrated by this guide https://documentation.onesignal.com/docs/react-native-sdk-setup
2. Have user subscribe to Notifications in production app build in iOS
3. Send out Push Notification message from OneSignal Dashboard to Subscribers

What did you expect to happen?

I expected to receive a push notification on my device with the content I sent out from the OneSignal dashboard

OneSignal Expo SDK version

2.0.0

Platform

iOS

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@TierryBr
Copy link

TierryBr commented Nov 9, 2023

I have the same problem

@darmoment
Copy link

Did anyone ever figure this out?

@smail-aouissa
Copy link

Same here

@michelazzam
Copy link

michelazzam commented Apr 8, 2024

Same here!

In app notification works fine. But the push notification isn't working

@QB3L
Copy link

QB3L commented May 17, 2024

Same exact issue. Verbose logs don’t show anything. Devices seem to be registering fine as well. I’m not used to using p8 key for setup but it should work for both sandbox and production. I’m not clear when OneSignal uses one over the other though (what is it looking at to differentiate?)

@qb3l-pplsi
Copy link

For reference. Testing with the simple code below correctly sends and receives a notification so it seems the app setup is correct. I encourage everybody to try the same

const apn = require('apn')

const provider = new apn.Provider({
    token: {
        key: './my_p8_file.p8', // Path to the .p8 file
        keyId: 'MY_P8_KEY_ID', // The Key ID associated with the .p8 file
        teamId: 'MY_TEAM_ID', // The Team ID associated with your Apple Developer account
    },
    production: false, // false for development
})

// Create a notification
const notification = new apn.Notification()
notification.alert = 'Hello, this is a test push notification!'
notification.sound = 'default'
notification.topic = 'com.acme.come' // Replace with your app's bundle ID

// Replace with the device token you want to send the notification to
// In OneSignal, this is called the "Push Token" and you need to enable
// the column to see it under Audience -> Subscriptions
const deviceToken = '<DEVICE_PUSK_TOKEN>'

// Send the notification
provider
    .send(notification, deviceToken)
    .then((result) => {
        console.log(result.sent.length)
        console.log(result.failed.length)
        console.log(result.failed)
    })
    .catch((error) => {
        console.log('ERROR:', error)
    })

@bilalkashif26
Copy link

I ran into the same problem a few weeks ago and after verifying the code and all other things, I've tried to revoke the .p8 key in the Apple developers account, creates a new one, and add it to one signal in IOS Platform. And push notifications started working.

  • Upload your .p8 file
  • Add your newly created key
  • Add your team ID

Note that you have to add push notifications capability while creating a new key in apple developer console of your app

Screenshot 2024-06-28 at 12 14 55 PM

@jennantilla
Copy link

Hello everyone! Apologies that this issue has gone stale. Please upgrade to the latest version of our SDK and open a new issue if you are still having trouble. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants