首页 > 解决方案 > 自定义 Cocoapod 总是返回“No such module XXX”

问题描述

我按照这里找到的指南

这是我的.podspec文件

Pod::Spec.new do |s|
  s.name         = "iOSUtils"
  s.version      = "0.0.1"
  s.summary      = "A really short description of MyFramework."
  s.description  = <<-DESC
  A much much much longer description of MyFramework.
                   DESC
  s.homepage     = "https://github.com/xxxxxxx/ios-utils"
  s.license      = "MIT"
  s.author       = { "xxxxxxx" => "xxxxxxx@xxxxxxx.io" }
  s.source       = { :path => '.' }
  # s.source       = { :git => "https://github/samwize/MyFramework", :tag => "#{s.version}" }
  s.source_files  = "Source/**/*.swift"
end

我的解决方案是 在此处输入图像描述

出于测试目的,我创建了一个简单的服务

public class TestService {
    static public let shared = TestService()
    private init() { }

    public func foo() {
        print("bar")
    }
}

我的Podfile项目将使用这个新框架pod 'iOSUtils', :path => '../iOSUtils',运行 install 返回成功消息。

但是,当我尝试导入我的模块时,我收到no such module错误并且无法构建。

还查看我的项目,我看不到开发 pod 下包含的源代码

在此处输入图像描述

标签: iosswiftcocoapods

解决方案


尝试将您的包名称添加到s.source_files您的iOSUtils.podspec文件中。

  s.source_files  = "iOSUtils/Source/**/*.swift"

推荐阅读