【问题标题】:getting error: use of undeclared type when I push pod to private cocoapods repo出现错误:当我将 pod 推送到私有 cocoapods 存储库时使用了未声明的类型
【发布时间】:2019-09-11 18:51:42
【问题描述】:

我可以成功构建、运行我的测试方案。我尝试通过执行以下操作将更改推送到我的 Pod 的存储库:

pod repo push my-private-cocoapods Device.podspec --allow-warnings --verbose

但我收到以下错误:

- ERROR | [Device/Phone] xcodebuild:  Device/Phone/Classes/Views/StackProvider.swift:13:42: error: use of undeclared type 'MacAddress'

然而MacAddresspublic 类型。

我重新启动了我的 mac,清理了构建,清理了派生数据,但我仍然遇到同样的错误。

【问题讨论】:

    标签: swift xcode cocoapods podspec


    【解决方案1】:

    问题是以下几种情况的结合:

    • 其中一个子 pod 依赖于来自同一个 pod 的另一个子 pod
    • 没有运行pod lib lint。我依赖于一个测试方案,只是通过 Xcode 在 vanilla 示例应用程序上运行测试。

    基本上我的Device/Phone 子pod 依赖于Device/Core 子pod。我需要更新我的Phone podspec。 目前是这样的:

    s.subspec 'Core' do |subspec|
        subspec.dependency 'RxSwift', '~> 4.5.0'
        subspec.dependency 'RxCocoa', '~> 4.5.0'
        subspec.source_files = 'Phone/Classes/*.{h,m,swift}', 'Phone/Classes/**/*.{h,m,swift}'
        subspec.test_spec 'Tests' do |test_spec|
          test_spec.source_files = 'Phone/Tests/*.swift'
        end
      end
    
      s.subspec 'Phone' do |subspec|
        subspec.dependency 'RxSwift', '~> 4.5.0'
        subspec.source_files = 'Phone/Classes/*.{h,m,swift}', 'Phone/Classes/**/*.{h,m,swift}'
        subspec.resources = 'Phone/Classes/*.{xib}', 'Phone/Classes/**/*.{xib}'
        subspec.test_spec 'Tests' do |test_spec|
          test_spec.dependency 'Device', '~> 1.0.7'
          test_spec.source_files = 'Phone/Tests/*.swift'
        end
    end
    

    我唯一需要添加的是我的 Phone 规范的依赖列表中的新依赖:

    subspec.dependency 'Device/Core',
    

    然后我就可以推送我的新规范了。

    pod repo push my-private-cocoapods Device.podspec --allow-warnings --verbose
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-30
      • 2016-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-01-21
      • 2011-04-29
      • 1970-01-01
      相关资源
      最近更新 更多