ios icon indicating copy to clipboard operation
ios copied to clipboard

[PushNotification] RCTPushNotificationManager.h not found

Open eramudeep opened this issue 5 years ago • 10 comments

Bug

I followed everything here (https://github.com/react-native-community/react-native-push-notification-ios ) to use PushNotification on iOS, but when I try to build the app, I get the following error.

RCTPushNotificationManager.h file not found

I even added RCTPushNotification.xcodeproj to Libraries but it still get the same error.

eramudeep avatar Dec 30 '19 08:12 eramudeep

With this package, you're supposed to use

#import <RNCPushNotificationIOS.h> and RNCPushNotificationIOS

instead of RCTPushNotificationManager.h and RCTPushNotificationManager

hroland avatar Jan 01 '20 21:01 hroland

Hi @eramudeep, did you solved this? I'm facing the same issue, I use #import <RNCPushNotificationIOS.h>

and I get the same error, RNCPushNotificationIOS.h file not found

I followed this step: Add the following to your Project: node_modules/@react-native-community/push-notification-ios/ios/PushNotificationIOS.xcodeproj Add the following to Link Binary With Libraries: libRNCPushNotificationIOS.a

jeypc avatar Jan 06 '20 08:01 jeypc

Hi,I am also facing same issue please guide here.

image

gauravsbagul avatar Jan 09 '20 12:01 gauravsbagul

Fixed this by 1: Uninstall package 2: Install package again 3: react-native link OR npx react-native link 4: cd ios -> pod install 5: cd .. Done!

gauravsbagul avatar Jan 21 '20 09:01 gauravsbagul

Well, following are detailed steps to migrate from @react-native-community/push-notification-ios

  1. npm i @react-native-community/push-notification-ios --save

  2. Sometime if you have older version of above lib, just remove node-module folder (rm -rf node_modules/) and re-run npm i on project root directory

  3. manually link react-native link @react-native-community/push-notification-ios (not need for react native version > 60 but I had to do it as it didn't work for me even if I had version 62).

  4. Make sure in iOS/pod file has following updates: remove line: pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS' New link is there: pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'

  5. Good to run to clean up the pod cache under iOS dir as: rm -rf Pods -- In iOS Folder

  6. in iOS dir, run pod install

  7. In AppDelegate.m file in you iOS folder perform following:

Replace #import <React/RCTPushNotificationManager.h> with #import <RNCPushNotificationIOS.h>

also find and replace RCTPushNotificationManager with RNCPushNotificationIOS Use following steps for App updates: https://github.com/react-native-community/push-notification-ios/blob/master/example/App.js

  1. Build project using react native command react-native run-is or npm run ios. In case build fails, run the project with Xcode with clean build option.

  2. Edit your Xcode build option to enable to ask (Product-->Scheme-->Edit Scheme) so that App can run on real iOS device.

  3. Make sure you run your app on Android to verify that build is not broken. ./gradlew clean npm run android or react-native run-android

  4. Also make sure that on your react-native app where ever you are performing any action related to iOS you check Platform as shown below: if (Platform.OS === 'ios') { notification.finish(PushNotificationIOS.FetchResult.NoData); }

Screen Shot 2020-05-01 at 1 34 48 PM

sumeet07 avatar May 01 '20 21:05 sumeet07

Any update on this issue, i'm also facing the same issue.

agrawalsurabhi89 avatar May 05 '20 05:05 agrawalsurabhi89

For me, it worked. what i did is 1. Changed #import <RNCPushNotificationIOS.h> and RNCPushNotificationIOS instead of RCTPushNotificationManager.h and RCTPushNotificationManager 2. I added Header search path to $(SRCROOT)/../node_modules/@react-native-community/push-notification-ios/ios to non-recursive.. Then clean the project and build it again it worked.

agrawalsurabhi89 avatar May 05 '20 06:05 agrawalsurabhi89

Neither automatic nor manual linking worked for me (RN 0.62), I had to add

pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'

to my Podfile myself. Then it worked.

dolsem avatar Jun 16 '20 01:06 dolsem

I've fixed this by manually adding the following header search path.

"${SRCROOT}/../node_modules/@react-native-community/push-notification-ios/ios"

image

acro5piano avatar Oct 22 '20 16:10 acro5piano

Just Import to AppDelegate.h file instead of AppDelegate.m file

Screenshot 2021-12-23 at 4 51 21 PM

VivekVithlani avatar Dec 23 '21 11:12 VivekVithlani