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

Not receiving push notifications on ios #1413

Closed
tushar-fitlov opened this issue Jul 27, 2022 · 5 comments
Closed

Not receiving push notifications on ios #1413

tushar-fitlov opened this issue Jul 27, 2022 · 5 comments

Comments

@tushar-fitlov
Copy link

tushar-fitlov commented Jul 27, 2022

Description:

I am using Expo and the latest onesignal sdk for the notifications. The notifications are working fine for the android devices. But I am not receiving any notifications on ios.
First I had trouble with different issue. The ios users were displaying "Missing Push Capability" on the onesignal users list. I fixed that by moving the onesignal-expo-plugin to the top of the plugins on app.json.
This issue is solved but notifications are not coming on ios devices now.
I am using eas build command to build the app and then uploading the app to testflight and begin testing.


Environment

react-native-onesignal: "^4.3.11"
onesignal-expo-plugin: "^1.0.2"

Steps to Reproduce Issue:

  1. Installed the libraries with yarn add react-native-onesignal and expo install onesignal-expo-plugin
  2. added the plugin on app.config.js:
plugins: [
   [
     "onesignal-expo-plugin",
     {
       mode: process.env.NODE_ENV || "development",
     },
   ],
  1. Initialized the SDK:
OneSignal.setLogLevel(6, 0);
  OneSignal?.setAppId(Constants?.manifest?.extra?.oneSignalAppId);
  OneSignal.promptForPushNotificationsWithUserResponse((response) => {
    console.log("Prompt response:", response);
  });
  OneSignal.setNotificationWillShowInForegroundHandler(
    (notificationReceivedEvent) => {
      let notification = notificationReceivedEvent.getNotification();
      const data = notification.additionalData;
      console.log("additionalData: ", data);
      notificationReceivedEvent.complete(notification);
    }
  );
  OneSignal.setNotificationOpenedHandler((notification) => {
    const deeplink = notification.notification.launchURL;
    if (deeplink) {
      Linking.openURL(deeplink);
    }
  });

Anything else:

Tested sending the notification using the REST API.

curl --request POST \
  --url https://onesignal.com/api/v1/notifications \
  --header 'Authorization: Basic SecretKey' \
  --header 'Content-Type: application/json' \
  --data '{
	"include_player_ids": ["1ec3a53b-3237-45f8-93f7-f9a26b21048e"],
	"app_id": "Onesignal App ID",
	"headings": {"en": "Test From Insomnia"},
	"contents": {"en": "Message from REST API"}
}'

The response from the api:

{
	"id": "7d868c64-4121-480d-8aa2-8328c8d14aa6",
	"recipients": 1,
	"external_id": null
}

Is there any steps I am missing for the ios?

@IsmayilH
Copy link

IsmayilH commented Sep 5, 2022

facing same issue on 4.3.8 React native cli project, Works on android but not getting push on iOS

@seyaobey-dev
Copy link

Facing same issue also: it works fine on android but not on ios.

Expo sdk: 46
"onesignal-expo-plugin": "^1.1.1",
"react-native-onesignal": "^4.4.1",

@obrienbcg
Copy link

Facing same on iOS. Works fine on Android. The iOS "ad hoc" builds work fine. Builds pushed to TestFlight show up as "Missing Push Capability". Certs & provisioning profile seem fine. Anyone find resolution(s) to this or have any ideas of things to try?

@gui10l1
Copy link

gui10l1 commented May 2, 2023

Same issue

"react-native": "0.68.2",
"onesignal-expo-plugin": "^1.3.0",
"react-native-onesignal": "^4.5.0",

@jennantilla
Copy link
Contributor

Hello everyone. This issue will be closed as it has become stale. Since this issue was filed, we have had several new release of our Expo plugin. Please upgrade to the latest version and if there are still any issues, please submit a new issue. We will be happy to take a look if anyone is 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

6 participants