react-native-onesignal
react-native-onesignal copied to clipboard
Not receiving push notifications on ios
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:
- Installed the libraries with
yarn add react-native-onesignalandexpo install onesignal-expo-plugin - added the plugin on
app.config.js:
plugins: [
[
"onesignal-expo-plugin",
{
mode: process.env.NODE_ENV || "development",
},
],
- 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?
facing same issue on 4.3.8 React native cli project, Works on android but not getting push on iOS
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",
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?
Same issue
"react-native": "0.68.2",
"onesignal-expo-plugin": "^1.3.0",
"react-native-onesignal": "^4.5.0",
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!