【问题标题】:Sub-project does not find Swift modules installed via Pods子项目找不到通过 Pod 安装的 Swift 模块
【发布时间】:2019-03-22 04:28:06
【问题描述】:

我创建了一个反应原生模块RNKin。我尝试通过 Pods 安装此模块/库的依赖项。

播客文件

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

target 'demo_pods' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!
  use_modular_headers!

  # Pods for demo_pods

  pod 'KinEcosystem', '0.5.4'
  pod 'JWT', '3.0.0-beta.11'
  pod 'Alamofire'

end

子项目(我的 RNKin 库)在 .swift 文件中导入这些 pod 框架(KinEcosystem、Alamofire、JWT)(如您在屏幕截图中所见) 但是当我尝试构建 demo_pods 项目时,它失败并出现错误“No such module xxx”。

我尝试了框架/标题搜索路径的每种组合。而且我不知道怎么了:(

完整安装的项目可以在这里下载:https://www.dropbox.com/s/ixy0tip3etb8sb3/demo_pods.zip?dl=0 (pods 和 node_modules 已经安装)

经过几天的反复试验,我发布了这篇文章,希望有人可以帮助我,那太棒了!!! =)

【问题讨论】:

    标签: ios swift xcode react-native cocoapods


    【解决方案1】:

    修复了我的Podfile

    # Uncomment the next line to define a global platform for your project
    platform :ios, '9.0'
    
    use_frameworks!
    use_modular_headers!
    
    workspace 'demo_pods.xcworkspace'
    
    def shared_pods
      pod 'KinEcosystem', '0.5.4'
      pod 'JWT', '3.0.0-beta.11'
      pod 'Alamofire'
    end
    
    target 'demo_pods' do
      shared_pods
    
      target 'RNKin' do
        project '../node_modules/react-native-kin/ios/RNKin.xcodeproj'
        inherit! :search_paths
      end
    end
    

    【讨论】:

      【解决方案2】:

      像这样编辑您的Podfile

      # Uncomment the next line to define a global platform for your project
      platform :ios, '9.0'
      
      target 'demo_pods' do
        # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
        use_frameworks!
        use_modular_headers!
      
        # Pods for demo_pods
      
        pod 'KinEcosystem', '0.5.4'
        pod 'JWT', '3.0.0-beta.11'
        pod 'Alamofire'
      
        target 'RNKin' do
            inherit! :search_paths
        end
      
      end
      

      如果没有帮助,请重播。

      【讨论】:

      • 感谢您的回复。但这不起作用: pod install: [!] 找不到名为 RNKin 的目标,但确实找到了 demo_podsdemo_podsTestsdemo_pods-tvOSdemo_pods-tvOSTests跨度>
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-16
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多