【问题标题】:No such module 'ModuleName' error when using CocoaPods without 'use_frameworks!' option在没有“use_frameworks!”的情况下使用 CocoaPods 时没有这样的模块“ModuleName”错误!选项
【发布时间】:2019-01-09 08:40:32
【问题描述】:

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

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

  • CocoaPods:1.5.3
  • Xcode:10.1
  • 斯威夫特:4.0

Pod 文件:

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

【问题讨论】:

    标签: ios xcode cocoapods


    【解决方案1】:

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

    如果没有并且您可以提供足够的信息进行复制,请提交CocoaPods issue

    【讨论】:

      【解决方案2】:

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

      我们可以通过BridgingHeader 导入我们使用的类,而不是使用use_modular_headers! 选项。您需要做的是在您的 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>
      

      【讨论】:

        猜你喜欢
        • 2023-04-01
        • 2015-09-12
        • 2015-12-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-02-16
        • 2020-06-15
        相关资源
        最近更新 更多