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

XCode/iOS No such module 'RNPush' in AppDelegate.swift React-Native 0.64.0/0.64.1 #31493

Closed
jonahfidel-avant opened this issue May 7, 2021 · 1 comment
Labels
Needs: Triage 🔍 p: Expo Partner: Expo Partner Resolution: Locked This issue was locked by the bot.

Comments

@jonahfidel-avant
Copy link

jonahfidel-avant commented May 7, 2021

Description

I have been trying to upgrade react-native from my current version (0.60.0) to the latest version: 0.64.0 and, as of a couple days ago, 0.64.1
After making all of the necessary changes described here:
https://react-native-community.github.io/upgrade-helper/?from=0.60.0&to=0.64.1
The app runs on android but iOS is still failing. I am receiving the following error:
No such module 'RNPush' in AppDelegate.swift

image

This is a local package that my team built before I joined it. I have updated the podspec file in the local RNPush package and it gets linked during the pod install process successfully. RNPush.h is imported in my bridging header contained in the same folder as the AppDelegate.swift file. I have also tried multiple variations of adding the path to RNPush.h to the HEADER_SEARCH_PATHS in the xcode build settings (both for the main project and the local package, project and target) but nothing has worked. I know there are many similar issues that have been submitted in the past but nothing has solved my problem.

Additionally, when I try to manually link the local package instead instead of autolinking via the podspec, I get the following error:
'React/RCTBridgeModule.h' file not found

image

I have seen many issues addressing this error as well such as #26678, https://stackoverflow.com/questions/58373425/react-rctdefines-h-file-not-found-rn0-61/58398989#58398989, and https://stackoverflow.com/questions/41663002/react-rctbridgemodule-h-file-not-found but again, nothing works.
I have also tried adding the React pod to all of my schemes with no success.

This was working fine on RN 0.60.0 and I am at a loss as to where to go from here.

React Native version:

System:
OS: macOS 11.3.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 56.10 MB / 16.00 GB
Shell: 5.0.11 - /usr/local/bin/bash
Binaries:
Node: 12.22.1 - /usr/local/opt/node@12/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.12 - /usr/local/opt/node@12/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /Users/{user}/.rvm/gems/ruby-2.7.0/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 27, 28, 29
Build Tools: 26.0.2, 28.0.3, 29.0.2, 29.0.3, 30.0.0, 31.0.0
System Images: android-16 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7199119
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_242 - /usr/bin/javac
npmPackages:
@react-native-community/cli: ^5.0.1-alpha.2 => 5.0.1-alpha.2
react: 17.0.1 => 17.0.1
react-native: 0.64.1 => 0.64.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Upgrade react-native following guide here: https://react-native-community.github.io/upgrade-helper/?from=0.60.0&to=0.64.1
  2. Update cocoapods to 1.10.1
  3. Update local package podspec to min iOS version 10
  4. run react-native run-android (works fine)
  5. run react-native run-ios
  6. breaks with above errors depending on manual vs. automatic linking

Expected Results

React native app builds in xcode and from the command line and launches on simulator

Actual Results

Errors detailed above

@jonahfidel-avant
Copy link
Author

jonahfidel-avant commented May 12, 2021

SOLVED!

Manual linking was the solution since this was a legacy package.

1.) ignore the package in the react-native.config.js dependencies

'react-native-push': {
      platforms: {
        ios: null, // disable ios platform, other platforms will still autolink if provided
      },
    },

2.) drag the package xcodeproj into xcode libraries
image
3.) add the package dependency to the target build phases 'Dependencies'
4.) add the package binary to the target build phases 'Link Binary with Libraries'
5.) run the code and receive an error to the effect of:

fatal error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

6.) change the dependencies to match the new React Native dependency scheme with conditional logic based on the file tree (the .h file gets used from different locations and will continue giving errors without this logic)

#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import "../../node_modules/react-native/React/Base/RCTBridgeModule.h"
#endif

this may vary based on your own file tree, just look at the file structures to determine the correct path.

Hope this helps!

@facebook facebook locked as resolved and limited conversation to collaborators May 12, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs: Triage 🔍 p: Expo Partner: Expo Partner Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants