pod install 报错

来源:16-11 React Native 混合开发实战(iOS篇)-2【解锁新的开发方式】

qq_ElqSipty_0

2021-12-02

pod install时报错
[!] Invalid Podfile file: undefined method `[]’ for nil:NilClass.

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

platform :ios, '11.0'

target 'NativeOCIosTest' do
  # Comment the next line if you don't want to use dynamic frameworks OC 一般不需要使用 use_frameworks!
  # use_frameworks!

  # react-native 需要的相关配置
  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
  )

  # Pods for NativeOCIosTest

  # 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

  # 如果使用use_frameworks!需要添加这一部分,如果不使用则不需要(非常重要) OC 一般不需要使用 use_frameworks!
  # pre_install do |installer|
  #   Pod::Installer::Xcode::TargetValidator.send(:define_method,
  #   :verify_no_static_framework_transitive_dependencies) {}
  # end

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

  target 'NativeOCIosTestUITests' do
    # Pods for testing
  end

end
写回答

1回答

CrazyCodeBoy

2021-12-03

参考下这块课程源码中pod文件的配置检查下你的代码实现看是否有出入的地方

0
1
qq_ElqSipty_0
react-native 0.66.0的, Podfile文件内容和课程的不一样
2021-12-03
共1条回复

RN入门到进阶,打造高质量上线App

解锁React Native开发应用新姿势,React Native新版本热门技术

3144 学习 · 3241 问题

查看课程