React-RCTWebSocket.modulemap 中模块“React”的重新定义

问题描述 投票:0回答:2

美好的一天,

我们刚刚将

react-native
0.59.10
升级为
0.60.0
。 我们主要遵循这些指南:

https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0

https://mattoakes.net/react-native-upgrade-guides/upgrade-to-react-native-0.60

对于 Android 来说,升级过程非常简单。但我的团队在做 iOS 方面时遇到了很大困难

遵循这些指南并解决一些问题后,我们面临着一个我们找不到任何信息的问题......我们已经被困在这里有一段时间了。

所以,问题是:当我们构建项目时,出现下一个错误。 ERROR IMAGE

阅读一些类似的主题后,社区的其他人建议我们可以在 XCode 项目的目标中的

Build Settings
Build Phases
中添加相同的包两次。但我找不到任何一个:/

我怀疑错误来自我们的

Podfile
,但对我来说看起来不错:

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

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

use_modular_headers!

def pods()
  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', :modular_headers => false
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec', :modular_headers => false
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec', :modular_headers => false
end

target 'OneSignalNotificationServiceExtension' do
  # Pods for OneSignalNotificationServiceExtension
  use_native_modules!
end

target 'XXX' do
  # Pods for xxx
  pods()
  
  target 'XXXTests' do
    inherit! :search_paths
    # Pods for testing
  end
  
  use_native_modules!

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
      end
    end
  end

end

就是这样,有人可以帮助我们吗?

如果您希望我附加任何内容以获得有关错误的更多信息,请随时询问。

欢迎所有建议:)

reactjs xcode react-native cocoapods upgrade
2个回答
1
投票

我的 Pod 中的一个包也遇到了同样的问题,需要我使用

use_modular_headers!
设置。

这似乎会导致反应模块发生冲突,因为它定义了两次反应。对我来说,解决方法是在 podfile 中的每个 React 包后面添加

:modular_headers => false
。这是我的 React 版本 0.60.6 的 podfile 作为示例。

target ‘app’ do
  use_modular_headers!
  # Pods for RNDiffapp
  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’, :modular_headers => false
  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-RCTWebSocket’, :path => ‘../node_modules/react-native/Libraries/WebSocket’, :modular_headers => false
  pod ‘React-cxxreact’, :path => ‘../node_modules/react-native/ReactCommon/cxxreact’, :modular_headers => false
  pod ‘React-jsi’, :path => ‘../node_modules/react-native/ReactCommon/jsi’, :modular_headers => false
  pod ‘React-jsiexecutor’, :path => ‘../node_modules/react-native/ReactCommon/jsiexecutor’, :modular_headers => false
  pod ‘React-jsinspector’, :path => ‘../node_modules/react-native/ReactCommon/jsinspector’, :modular_headers => false
  pod ‘yoga’, :path => ‘../node_modules/react-native/ReactCommon/yoga’, :modular_headers => false
  pod ‘DoubleConversion’, :podspec => ‘../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec’, :modular_headers => false
  pod ‘glog’, :podspec => ‘../node_modules/react-native/third-party-podspecs/glog.podspec’, :modular_headers => false
  pod ‘Folly’, :podspec => ‘../node_modules/react-native/third-party-podspecs/Folly.podspec’, :modular_headers => false

我遗漏了 React 和 React-Core,因为这些是首先被重新定义的模块。


0
投票

在我的 pod 文件中启用

use_modular_headers!
后,我收到此错误,我的一些 pod 需要它,从而导致
no module found
错误。因此,我没有为每个 Pod 启用模块化标头,而是仅针对特定的情况进行切换:

  1. 禁用
    use_modular_headers!
  2. :modular_headers => true
    添加到每个需要它的 Pod
pod 'POD_NAME', 'x.x.x', :modular_headers => true
© www.soinside.com 2019 - 2024. All rights reserved.