免责声明 - 我对Xcode/iOS开发缺乏经验。在这一点上,我一直在谷歌搜索,但我只是在尝试我不理解的随机修复。我可以在Android上继续使用该应用程序,但是iOS支持是用户的要求。
当前构建错误:
Multiple targets match implicit dependency for product reference 'libReactNativeNavigation.a'.
Consider adding an explicit dependency on the intended target to resolve this ambiguity.
(in target 'AwesomeProject' from project 'AwesomeProject')
Multiple targets match implicit dependency for linker flag '-lReactNativeNavigation'.
consider adding an explicit dependency on the intended target to resolve this ambiguity.
(in target 'AwesomeProject' from project 'AwesomeProject')
背景
这是一个 React Native 移动应用程序,在过去的几个月里一直运行良好,直到两周前我还有其他重要的工作要转向。我两周前退出/关闭了Xcode,几天前重新打开以恢复,但是我遇到了类似错误
no podspec found in node_modules (I don't remember the exact problem)
在尝试修复它时,我解体/清理/修改/重新安装了 pod,如此处所述。
然后不知何故我得到了这个错误:
React/RCTEventEmitter.h file not found
(+ a 2nd similar message for another file)
今天,我试过 1. 清理派生数据 a. 相对于我的 Xcode 项目移动它, 2.将Build Active Architecture Only
设置为No
, 3. 第 5 步:如果 Xcode 在链接时抱怨...(除了我不认为这是我添加的 *.a 静态库?
现在,构建在几秒钟后失败:
Multiple targets match implicit dependency for product reference 'libReactNativeNavigation.a'.
Consider adding an explicit dependency on the intended target to resolve this ambiguity.
(in target 'AwesomeProject' from project 'AwesomeProject')
Multiple targets match implicit dependency for linker flag '-lReactNativeNavigation'.
consider adding an explicit dependency on the intended target to resolve this ambiguity.
(in target 'AwesomeProject' from project 'AwesomeProject')
我认为 Podfile 很简单?
platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'AwesomeProject' do
# Pods for AwesomeProject
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
pod 'React-DevSupport', :path => '../node_modules/react-native/React'
pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'react-native-camera', :path => '../node_modules/react-native-camera'
pod 'react-native-cameraroll', :path => '../node_modules/@react-native-community/cameraroll'
pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'
target 'AwesomeProjectTests' do
inherit! :search_paths
# Pods for testing
end
use_native_modules!
end
target 'AwesomeProject-tvOS' do
# Pods for AwesomeProject-tvOS
target 'AwesomeProject-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
这只是一个警告,我相信,在我的项目中也得到了一个警告。我手动链接库,完成了所有步骤,我的项目无法构建。由于没有错误,我认为它不起作用的原因一定是在这个警告中,但我错了。如果可以,请返回到错误"找不到React/RCTEventEmitter.h文件",因为这是可以解决的。React/RCTEventEmitter.h 文件未找到 @chitzui答案帮助我解决了我的问题
当我添加子规范时,它也发生在我身上。我无法更改此设置,但在您的情况下,ReactNative
是否支持All
子规范?抱歉,我对这个框架了解不多,因为我多年来一直在故意远离它;希望一些ReactNative
专家可以提供帮助。