Home > Mobile >  undefined method `use_unimodules!' when installing react-native-unimodules
undefined method `use_unimodules!' when installing react-native-unimodules

Time:09-18

Following this guide to install the react-native-unimodules left me with the following error when doing a pod install

[!] Invalid `Podfile` file: undefined method `use_unimodules!' for #<Pod::Podfile:0x00007ff24708eaa8>
Did you mean?  use_native_modules!.

 #  from /Users/Shared/workspace/App/ios/Podfile:7
 #  -------------------------------------------
 #  target 'reactProducerApp' do
 >    use_unimodules!
 #    config = use_native_modules!
 #  -------------------------------------------

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 'reactProducerApp' do
  use_unimodules!
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'reactProducerAppTests' 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.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
  end
end

Any ideas on what is going on?

CodePudding user response:

the installation of react-native-unimodules require the use of its own cocoapods. the use_unimodules! will be defined if you add this line below into the third line of your Podfile.

require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
  • Related