代码之家  ›  专栏  ›  技术社区  ›  macabeus

如何创建具有依赖关系的CocoaPod?

  •  1
  • macabeus  · 技术社区  · 8 年前

    我正在使用命令生成的骨架 pod lib create .

    我想创建一个依赖于其他两个pod的pod: PromiseKit AWSS3 然后,我更改Podfile:

    use_frameworks!
    
    target 'ruawss3_Example' do
      pod 'ruawss3', :path => '../'
      pod 'AWSS3'
      pod 'PromiseKit', '~> 4.0'
    
      target 'ruawss3_Tests' do
        inherit! :search_paths
    
        pod 'Quick'
        pod 'Nimble'
        pod 'FBSnapshotTestCase'
        pod 'Nimble-Snapshots'
      end
    end
    

    和使用 pod install :

    ➜  Example git:(master) ✗ pod install
    Analyzing dependencies
    Fetching podspec for `ruawss3` from `../`
    Downloading dependencies
    Using AWSCore (2.4.16)
    Using AWSS3 (2.4.16)
    Using FBSnapshotTestCase (2.1.4)
    Using Nimble (5.1.1)
    Using Nimble-Snapshots (4.4.0)
    Using PromiseKit (4.1.0)
    Using Quick (1.0.0)
    Using ruawss3 (0.1.0)
    Generating Pods project
    Integrating client project
    Sending stats
    Pod installation complete! There are 7 dependencies from the Podfile and 8 total pods installed.
    ➜  Example git:(master) ✗ pwd
    /Users/brunomacabeusaquino/ApenasMeu/Dropbox (BEPiD)/Swift/ruawss3/Example
    

    并在项目中添加此POD: enter image description here

    但是,我无法在Pods中编译文件>POD的开发>ruawss3>ruawss3>类>亚马逊3.swift。 Xcode找不到模块“AWSCore”。如何修复它?

    1 回复  |  直到 8 年前
        1
  •  7
  •   macabeus    8 年前

    我解决了我的问题。

    添加pod依赖项的正确位置是 .podspec 文件,使用构建设置 dependency 然后,执行 pod install .