gpt4 book ai didi

react-native - 使用 react-native-maps 和 use_frameworks 找不到 Pod 安装错误 `React/RCTView.h' 文件

转载 作者:行者123 更新时间:2023-12-04 03:04:44 27 4
gpt4 key购买 nike

我似乎无法使用 pod install 将 react-native-maps 安装到我的 react native ios 项目中。我收到警告 Missing dependency target "React"和一个 React/RCTView.h' file not found错误

https://github.com/react-community/react-native-maps/blob/master/docs/installation.md

我认为这是因为 use_frameworks! pod 文件中的标志。有什么合理的解决方法吗?

这是我的 pod 文件

platform :ios, '11.0'
target 'MyCoolApp' do
use_frameworks!
pod 'ViroReact', :path => '../node_modules/react-viro/ios/'
pod 'ViroKit', :path => '../node_modules/react-viro/ios/dist/ViroRenderer/'
# Required by RNFirebase
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Messaging'
pod 'Fabric', '~> 1.7.5'
pod 'Crashlytics', '~> 3.10.1'
pod 'Firebase/Database'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'Firebase/Performance'
pod 'Firebase/DynamicLinks'

rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'

# See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]

# React Native third party dependencies podspecs
pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
end

pre_install do |installer|
# workaround for CocoaPods/CocoaPods#3289
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end

最佳答案

我个人在 Podefile 中添加了一些代码来解决您在此处遇到的标题搜索路径问题

post_install do |installer|
puts 'post_install'
app_project = Xcodeproj::Project.open("./X.xcodeproj")
output = `find .. -name "*.xcodeproj"`
p output
output.split("\n").each do |projectPath|
app_project = Xcodeproj::Project.open(projectPath)
app_project.native_targets.each do |target|
target.build_configurations.each do |config|
if !config.build_settings['HEADER_SEARCH_PATHS']
config.build_settings['HEADER_SEARCH_PATHS'] ||= []
end
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] <<' $(SRCROOT)/../../../../ios/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../../../ios/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../../ios/Pods/Headers/**'
config.build_settings['HEADER_SEARCH_PATHS'] << ' $(SRCROOT)/../ios/Pods/Headers/**'
app_project.save
end
end
end
puts 'post_install DONE'
end
````

关于react-native - 使用 react-native-maps 和 use_frameworks 找不到 Pod 安装错误 `React/RCTView.h' 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50032255/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com