ReactNative升级0.63.0后Pod isntall失

2020-10-09  本文已影响0人  cvl陈

ReactNative升级0.63.0后项目变更

自从ReactNative升级到0.63.0后,大多数人会遇到iOS项目pod 失败,原因是node_modules内很多依赖变更导致pod install 失败无法pod 依赖文件,而解决办法便是 删除原有podfile,因为ReactNative现在改为动态配置pod
重新创建新的podfile
添加以下代码就即可

require_relative '../node_modules/react-native/scripts/react_native_pods'
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])

另外0.63.0也放弃了对iOS 9的支持
删除Pods文件夹 及podfile.lock 和.xcworkspace 文件
重新pod install
怎么样有没有很方便

下面贴一下本人项目的podfile文件内代码,望有助

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

platform :ios, '10.0'

target 'XXXX' do
  config = use_native_modules!
  use_react_native!(:path => config["reactNativePath"])

  target 'XXXXTests' 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 these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'XXXX-tvOS' do
  # Pods for XXXX-tvOS

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

XXXX 代表项目这没啥可说的也就提一嘴

上一篇下一篇

猜你喜欢

热点阅读