使用没有"use_frameworks"选项的CocoaPods时,没有这样的模块"模块名称"错误!



我想停止使用use_frameworks!,所以我的依赖项是静态链接的。据我所知,在这种情况下解决No such module 'ModuleName'错误的一种方法是在 Podfile 中添加use_modular_headers!

问题是use_modular_headers!带来了另一个错误。有没有办法避免use_frameworks!use_modular_headers!

  • 可可豆荚:1.5.3
  • Xcode:10.1
  • 雨燕:4.0

容器文件:

source 'https://github.com/CocoaPods/Specs.git'
plugin 'cocoapods-fix-react-native'
platform :ios, '11.0'
inhibit_all_warnings!
pod 'RxSwift'
pod 'RxCocoa'
target 'AppName' do
  pod 'RxDataSources'
  pod 'R.swift'
  pod 'Kingfisher'
  pod 'KDEAudioPlayer', :git => 'https://github.com/delannoyk/AudioPlayer.git', :branch => 'master'
  pod 'Firebase/Performance'
  pod 'Firebase/Core'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Messaging'
  pod 'Fabric'
  pod 'Crashlytics'
  pod 'GoogleMaps'
  pod 'VIMVideoPlayer'
  pod 'ReachabilitySwift'
  pod 'React', :podspec => '../../react/external/React.0.54.4.podspec.json', :subspecs => [
    'Core',
    'cxxreact',
    'DevSupport',
    'fishhook',
    'RCTLinkingIOS',
    'RCTWebSocket',
    'RCTVibration',
    'RCTText',
    'RCTSettings',
    # Contains deprecated UIKit stuff...
    # 'RCTPushNotification',
    'RCTNetwork',
    'RCTImage',
    'RCTGeolocation',
    'RCTBlob',
    'RCTAnimation',
    'RCTActionSheet',
    'ART',
    'PrivateDatabase',
    'jsinspector',
    'jschelpers',
    'CxxBridge'
  ]
  pod 'yoga', :podspec => '../../react/external/yoga.0.54.4.podspec.json'
  pod 'Folly', :podspec => '../react/node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'glog', :podspec => '../react/node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'react-native-video', :path => '../react/node_modules/react-native-video/react-native-video.podspec'
end

CocoaPods 1.6.0 预发布版可能会解决 use_modular_headers! 的问题。

如果没有,并且您可以提供足够的信息来重现,请提交CocoaPods问题。

我找到了一个解决方案,即使它看起来不好/可扩展。

我们可以导入我们使用的类,而不是使用use_modular_headers!选项BridgingHeader .您需要做的是在 Swift 项目中添加BridgingHeader.h文件,并导入您需要的所有标头。该文件将如下所示:

// These are imported manually to avoid using 'use_modular_headers!' option in Podfile.
// 'use_modular_headers!' leads to error with 'glog' dependency.
import <VIMVideoPlayer/VIMVideoPlayer.h>
import <VIMVideoPlayer/VIMVideoPlayerView.h>
import <React/RCTBridge.h>
import <React/RCTRootView.h>
import <React/RCTBundleURLProvider.h>

最新更新