Platform => IOS
Xcode => v10. 3
React native => v0.60.4
react-native-push-notification => v^3.1.8
Please help. What is the problem?
I think plugin is not working properly with latest version rn 0.60.4
Im tried different solutions but not working.
pod file
pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS'
I need to switch to v3.1.3 to make it works again.
I need to switch to v3.1.3 to make it works again.
not fixed,
Also having this issue on RN 0.60.4 and v3.1.8. I also tried downgrading to v3.1.3 and still having the same problem.
fixed this issue with the following using v3.1.8.
Make sure you've already installed @react-native-community/push-notification-ios so it's in your node_modules.
added this line to Podfile
pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios/RNCPushNotificationIOS.podspec'
Then run inside your ios directory
pod install
actually I dont think that podfile mod is necccessary, due to autolinking.
the change is due to IOSpush being shifted from core react to 'community'
so you need to include the community one in your package, and change your appdelegate to the new push IOS library. that should work
This is not good solution, Finally i removed package from project !
Alternatively im using now firebase.notifications()
The @spacewaffle solution is working,
Just to complete, you'll have to manually link the PushNotificationIOS like before, following this
Only notice that
#import <React/RCTPushNotificationManager.h>
becomes
#import <RNCPushNotificationIOS.h>
And you'll also have to change
RCTPushNotificationManager
to
RNCPushNotificationIOS
everywhere in the copied lines.
Edit: Just went on the npm page of @react-native-community/push-notification-ios and everything is detailed here
@lbnlrnt then using
import PushNotificationIOS from "@react-native-community/push-notification-ios"; ???
but android ?
this way needed
for ios
import PushNotificationIOS from "@react-native-community/push-notification-ios";
for android
import PushNotification from "react-native-push-notification";
This is not good solution
it is cross platform application one package must be working both device
@Developer-Nijat if you are using the latest version then import PushNotification from 'react-native-push-notification'; is now using the PushNotificationIOS from the community package, so you do not have to do the two imports, this package does it for you.
You just have to unlink the react native core version and then link the community version and then you can still use import PushNotification from 'react-native-push-notification'; as before.
@Developer-Nijat The thing is react-native-push-notification carry everything for android side and react-native link react-native-push-notification does most of the linking job for android only (you can notice that with the log being android only). On IOS side, we allways had to manually link the PushNotificationIOS within AppDelegate.m.
Before, the steps were describe by react native team themself because PushNotificationIOS was a module of react native. Now this package can be found as @react-native-community/push-notification-ios. So you have to follow the steps provided by them, here at section AppDelegate.m but nothing else.
The big thing is that the naming has changed but it basically the same thing.
To resume:
yarn add react-native-push-notification
react-native link react-native-push-notification
yarn add @react-native-community/push-notification-ios
cd ./ios && pod install && cd ..
And when you will use it you just have to :
import PushNotification from 'react-native-push-notification'
And it works cross platform.
Hi, if you still that error, you can keep version 3.1.1 (example not ^3.1.1)
Can you at least add this issue to install section? It's pretty much unusable now with 0.60.X react.
In
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: function(token) {
console.log("TOKEN:", token);
},
// (required) Called when a remote or local notification is opened or received
onNotification: function(notification) {
console.log("NOTIFICATION:", notification);
// process the notification
// required on iOS only (see fetchCompletionHandler docs: https://github.com/react-native-community/react-native-push-notification-ios)
notification.finish(PushNotification.FetchResult.NoData);
},
notification.finish(pushnotificationIOS.FetchResult.NoData);
"can't find variable pushnotificationIOS".
I have change pushnotificationIOS for PushNotification??
Downgrading to 3.1.1 fixed this for me.
@spacewaffle This solution works for me as well. Thank you.
My upgrade path was a little more involved - posted here.
yarn add react-native-push-notificationyarn add @react-native-community/push-notification-iosreact-native link @react-native-community/push-notification-iosOne more gotcha - when testing that it works, make sure your app is closed or a local notification won't fire.
Unfortunately none of the solutions in this thread helped me getting the package to run:
react-native: 61.4
react-native-push-notification: 3.1.9
react-native-push-notification-ios: 1.0.2
I had to:
Any updates on this issue are appreciated.
@schumannd Was able to resolve this issue with below given versions
react-native: 0.61.4
react-native-push-notification: 3.1.9
For iOS follow below given link
For Pod Updates:
cd ios, open Podfile and make below given changes
# pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS' ----> Remove
pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios/RNCPushNotificationIOS.podspec' ----> Add
After modification to Podfile, run pod install inside ios folder.
Most helpful comment
fixed this issue with the following using v3.1.8.
Make sure you've already installed @react-native-community/push-notification-ios so it's in your node_modules.
added this line to Podfile
pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios/RNCPushNotificationIOS.podspec'Then run inside your ios directory
pod install