Har*_*ngh 10 dependencies ios cocoapods reactjs react-native
我正在尝试将继承的项目从 React Native 0.64 升级到 0.68。我遇到了许多与 Cocoapod 相关的错误,特别是React-Codegen在 React-native npm 包中不再作为 podspec 存在的错误。
奇怪的是,我无法在线参考其他遇到此特定 podspec 问题的人。这通常意味着还有其他问题,这是一个“红鲱鱼”。
下面是我的 Podfile 的一个子集。我想知道设置是否已更改,以便我不再需要显式声明所有这些 pod 依赖项?有人有主意吗?
pod 'React', :path => '../node_modules/react-native/', :modular_headers => false
pod 'React-Core', :path => '../node_modules/react-native/', :modular_headers => false
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules', :modular_headers => false
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/', :modular_headers => false
pod 'React-perflogger', :path => "../node_modules/react-native/ReactCommon/reactperflogger", :modular_headers => false # dep for DevSupport
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS', :modular_headers => false
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation', :modular_headers => false
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob', :modular_headers => false
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image', :modular_headers => false
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS', :modular_headers => false
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network', :modular_headers => false
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings', :modular_headers => false
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => false
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration', :modular_headers => false
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/', :modular_headers => false
pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART', :modular_headers => false # No longer a pod
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact', :modular_headers => false
Run Code Online (Sandbox Code Playgroud)
小智 8
在应用程序的顶部添加以下语句Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
Run Code Online (Sandbox Code Playgroud)
我们在上一步中需要的文件定义了use_react_native!我们在下一步中需要调用的方法。
use_react_native!现在,在应用程序的目标名称之前调用该方法,Podfile如下所示:
use_react_native!
target 'Example' do
...
end
Run Code Online (Sandbox Code Playgroud)
pod install最后,在应用程序的根目录运行命令
$ pod install
Run Code Online (Sandbox Code Playgroud)
小智 1
我得到了它!
显然,反应创建一个脚本,其中包含构建所需的所有标准 Pod
所以到目前为止我所做的是做一个react-native init 来生成默认的podfile,它与旧的有很大不同
这里是
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'
install! 'cocoapods', :deterministic_uuids => false
target 'onboardingF2fApp' do
config = use_native_modules!
# Pods for onboardingF2fApp
pod 'GooglePlaces', '3.1.0'
pod 'GooglePlacePicker'
pod 'GoogleMaps'
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
end
post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
target 'onboardingF2fAppTests' do
inherit! :search_paths
# Pods for testing
end
end
Run Code Online (Sandbox Code Playgroud)
基本上这个脚本会替换您帖子中的所有 pod
require_relative '../node_modules/react-native/scripts/react_native_pods'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9071 次 |
| 最近记录: |