[SOLVED] react native app working on android but issues on iOS, details shared in description

Issue

I am working on an app that was written 2 years ago, so now I’m trying to build that code on android and ios. When i do pod install from vscode in ios folder and then i am building that iOS code in xcode, then i face 'React/RCTBridgeModule.h' file not found Lexical or Preprocessor Issue under one of pods project.
My efforts:

  1. Cleared node modules cache or deleting it and then reinstalling.
  2. I tried to remove my Pods directory and then run pod install I open the .xcworkspace like it is written in the logs on the pod install, I clean the project on xcode and then try to build but it won’t works…
  3. Set same ios build target for all pod files and project.

here is my pod file:

    require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'MyAppName' do
  use_modular_headers!   // here i have also tried use_frameworks!
  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"  

  # React Native Maps dependencies
  # pod 'react-native-google-maps', :path => '../node_modules/react-native-maps'
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  # pod 'GoogleMaps'
  # pod 'Google-Maps-iOS-Utils'

  #firebase
  pod 'Firebase/Core'
  pod 'Firebase/Messaging'
  

  use_react_native!(
    # :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )
  
  #pod 'RNFirebase', :path => '../node_modules/react-native-firebase'
  #pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

  pod 'ReactNativeExceptionHandler', :path => '../node_modules/react-native-exception-handler'

  #pod 'react-native-maps', :path => '../node_modules/react-native-maps'
  pod 'react-native-maps', path: '../node_modules/react-native-maps'
  pod 'react-native-google-maps', path: '../node_modules/react-native-maps'
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'RNSVG', :path => '../node_modules/react-native-svg'

  target 'MyAppNameTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.

  post_install do |installer|
    react_native_post_install(installer)
  end
end

Cannot find protocol declaration for 'RCTInitializing'

Xcode version: 12.0(12A7209),

react: "17.0.1",

react-native: "0.63.4",

Please let me know if anything else is required and help me in resolving this error.TIA

UPDATE

Cannot find protocol declaration for 'RCTInitializing'

Solution

for this issue, one has to add

Add pod 'React-logger', :path => '../node_modules/react-native/ReactCommon/logger'

ref

Answered By – Paramjit Singh Rana

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.