微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

未定义的方法`use_unimodules!'安装 react-native-unimodules 时

如何解决未定义的方法`use_unimodules!'安装 react-native-unimodules 时

按照 this 指南安装 react-native-unimodules 让我在执行 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!
 #  -------------------------------------------

这是我的 Pod 文件

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

对正在发生的事情有什么想法吗?

解决方法

安装 react-native-unimodules 需要使用它自己的 cocoapods。如果您将下面的这一行添加到您的 use_unimodules! 的第三行中,将定义 Podfile

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。