2

I am creating an app using React Native and am trying to install cocoa pods for iOS but when I enter pod install into the terminal I get the following warning.

eror

Then when I try to run my app in an iOS emulator it crashes and won't run.

Here is the Xcode error.

error

I am running react native 0.63.2.

Here is my pod file

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'

target 'Example' do
  # Comment the next line if you don't want to use dynamic frameworks
  #use_frameworks!

  # Pods for Example


  # pod 'React', :path => '../node_modules/react-native'

  pod 'RNSound', :path => '../node_modules/react-native-sound'


  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  pod 'RNCMaskedView', :path => '../node_modules/@react-native-community/masked-view'

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

  pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'

  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'

  pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth'

  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'

  pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'

  pod 'RNScreens', :path => '../node_modules/react-native-screens'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  target 'Example-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
   

  end

  target 'ExampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'Example-tvOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Example-tvOS

end
CodeLover
  • 166
  • 1
  • 11
  • 34
  • you started to get this issue when you add firebase messaging or when ? – anthony willis muñoz Aug 26 '20 at 11:58
  • no, i still have to problem even when fireballs messaging is not there – CodeLover Aug 26 '20 at 12:10
  • you open xworkspace ? try to add the crash you got in the logs to help u properly – anthony willis muñoz Aug 26 '20 at 12:17
  • added to my question – CodeLover Aug 26 '20 at 12:36
  • 1
    It seems that you are having issue in setting up project dependencies at the first place, especially with firebase. One thing I notice your pod file is missing `use_native_modules!`. You may refer to the this [link here](https://stackoverflow.com/a/60521779/4311268) which tells you where to place `use_native_modules!`. Once you have it, remove podfile.lock and pods. Then run `pod install` again – Tommy Leong Aug 27 '20 at 16:14
  • I have noticed that use_native_modules! has changed to use_react_native!, however this has fixed the problem. Thank you for your help – CodeLover Aug 28 '20 at 14:01
  • How would you use `require_relative` when your ios app sits in a different repo and react native sits in a completely different repo? – Shivam Sahil May 23 '22 at 10:01

1 Answers1

0

The issue is that you don't install pod for the correctly target. This is strange if this is a new RN project because it should take the correct target. In you recently image added seems like you have another target called AntrimElimChurch so if you want to install pod for that target you should change it in PodFile as well

am running react native 0.63.2.

Here is my pod file

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'

target 'AntrimElimChurch' do
  # Comment the next line if you don't want to use dynamic frameworks
  #use_frameworks!

  # Pods for Example


  # pod 'React', :path => '../node_modules/react-native'

  pod 'RNSound', :path => '../node_modules/react-native-sound'


  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

  pod 'RNCMaskedView', :path => '../node_modules/@react-native-community/masked-view'

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

  pod 'react-native-slider', :path => '../node_modules/@react-native-community/slider'

  pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'

  pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth'

  pod 'RNFBMessaging', :path => '../node_modules/@react-native-firebase/messaging'

  pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'

  pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'

  pod 'RNScreens', :path => '../node_modules/react-native-screens'

  pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

  target 'Example-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
    pod 'react-native-notifications', :path => '../node_modules/react-native-notifications'

  end

  target 'ExampleTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

target 'Example-tvOS' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Example-tvOS

end

After this change run again pod install and it should build

anthony willis muñoz
  • 2,346
  • 3
  • 16
  • 33