我正在使用react native:0.41.2,react:15.4.2和cocoapods for firebase(https://github.com/evollu/react-native-fcm)。 构建代码时遇到问题。 'React / RCTEventEmitter.h','React / RCTBridgeModule.h','React / RCTViewManager.h','React / RCTDefines.h'找不到这些文件错误在运行项目时抛出
但是通过单击带有该文件名的ctrl,这些文件已经存在于我的项目中。 Image
podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'Inspector' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Inspector
react_native_path = "../node_modules/react-native"
pod "React", :path => react_native_path, :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'Inspector-tvOSTests' do
inherit! :search_paths
pod 'Firebase/Messaging'
# Pods for testing
end
target 'InspectorTests' do
inherit! :search_paths
pod 'Firebase/Messaging'
# Pods for testing
end
end
答案 0 :(得分:1)
对于那些面临此问题的人来说,这是由于本地0.41.2和cocoapods的头部导入问题 要解决这些错误,请按以下步骤操作
1 npm install -g react-native-git-upgrade
2转到项目根文件夹并执行
react-native-git-upgrade
3解决升级RN时出现的冲突
4现在从pod文件中删除React依赖项,否则你将在方案中有两个React(一个RN和一个Pod),它将在构建时导致no input error
。您的pod文件应该如下所示
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'Inspector' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Inspector // Pods for your app, in this case firebase is used
pod 'Firebase/Core'
pod 'Firebase/Messaging'
target 'Inspector-tvOSTests' do
inherit! :search_paths
pod 'Firebase/Messaging'
# Pods for testing
end
target 'InspectorTests' do
inherit! :search_paths
pod 'Firebase/Messaging'
# Pods for testing
end
end
5 cd ios&& pod install
6关闭Xcode并打开.xcworkspace文件