2015-07-11 100 views
5

在我的項目中,我參考了我公司使用的幾個專用豆莢。其中一個名爲DKKit的莢依賴於另一個我稱之爲BaseProKit的私有莢。 BaseProKit包含3個框架,它在它的頭文件和實現文件中引用,我認爲它們被認爲是vendored_frameworks。在BaseProKit的現有頭文件中,通過像#import <PPCommon/PPCommon>這樣的進口引用了這些框架,這些工作在單獨依賴BaseProKit窗格進行編譯時工作得很好(通常)。但是,包含DKKit時,DKKit在導入時會查找頭別名(BaseProKit.h),其中包含上述導入。然而,在DKKit的情況下,似乎DKKit窗格並不知道PPCommon框架的存在,它只能看到它的頭文件的別名通過Pods-BaseProKit引用。因此,任何和所有對<PPCommon/ANYTHING>的引用都會產生編譯錯誤(未找到),並且迄今爲止唯一能夠找出的方法是通過#import "PPCommon.h"引用,這將需要我調整所有導入整個BaseProKit項目,這並不正確。在沒有被項目或其他豆莢認可的豆莢內供應框架(Cocoapods/Cocoapods#3810)

我已經包括了參考下列文件: 的Podspec爲BaseProKit:

s.name   = "BaseProKit" 
    s.version  = "1.0.5" 
    s.source_files = "BaseProKit/BaseProKit.h", 
        "BaseProKit/Data/*.{h,m}", 
        "BaseProKit/Sensor Calibration/*.{h,m}", 
        "BaseProKit/SP3D/BaseballSceneController/*.{h,m}", 
        "BaseProKit/SP3D/SceneElements/*.{h,m,hpp,cpp}", 
        "BaseProKit/SP3D/SceneEnvironment/*.{h,m}", 
        "BaseProKit/Third Party/DeviceModelDetector.{h,m}", 
        "BaseProKit/Third Party/SkyProKitEmptyMMFile.{h,mm}" 
    s.resources = "BaseProKit/SatelliteLibrary/SatelliteLibrary.bundle","BaseProKit/SP3D/SP3DResources.bundle", "BaseProKit/SP3D/Models/Vertex Data/*" 
    s.frameworks = "GLKit", "OpenGLES", "Foundation", "UIKit", "Accelerate", "PPCommon", "SatelliteLibrary", "SP3D" 
    s.library = 'c++' 
    s.prefix_header_file = "BaseProKit/BaseProKit-Prefix.pch" 
    # s.public_header_files = "BaseProKit/PPCommon/PPCommon.framework/Headers/*.h", "BaseProKit/SatelliteLibrary/SatelliteLibrary.framework/Headers/*.h", "BaseProKit/SP3D/SP3D.framework/Headers/*.h" 

    s.vendored_frameworks = "BaseProKit/PPCommon/PPCommon.framework", 
          "BaseProKit/SatelliteLibrary/SatelliteLibrary.framework", 
          "BaseProKit/SP3D/SP3D.framework" 

的Podspec爲DKKit:

s.name   = "DKKit" 
    s.version  = "1.0.0" 

    s.source_files = 'DKKit/**/*.{h,m}' 
    s.resources = 'DKKit/**/*.xcdatamodeld' 
    s.dependency 'PromiseKit/Promise', '~> 1.3.0' 
    s.dependency 'MBProgressHUD', '~> 0.9.1' 
    s.prefix_header_contents = '#import "NSDictionary+Merge.h"' 
    s.frameworks = 'CoreData' 

    s.dependency 'BaseProKit', '~> 1.0.5' 
    s.dependency 'SwingAnalysisKit', '~> 1.0.0' 

我的項目的Podfile:

pod 'SwingAnalysisKit', :git => "https://swing-analysis-kit-URL", :branch => "develop" 
pod 'BaseProKit', :git => "https://base-pro-kit-URL", :branch => "develop" 
pod 'DKKit', :git => "https://DKKit-URL", :branch => "develop" 

是有任何事情可以在我的任何一個吊艙中做不同的事情spec文件(特別是BaseProKit的文件),以確保這些框架可以作爲框架(而不僅僅是它們的頭文件)在Pod本身之外引用

複製這也對的CocoaPods /的CocoaPods庫作爲一個問題: https://github.com/CocoaPods/CocoaPods/issues/3810

回答

1

有許多對與此有關的CocoaPods回購提出的問題 - 例如,18243161。我相信它已被固定在0.38.0.beta.1 -

增加了在沙箱中自動鏈接的自助鏈接的公共標題的遞歸支持。這解決了包含子目錄的框架頭目錄的問題。 Todd Casey#3161

現在,自動鏈接到沙盒中的已出售框架的公共標題。這允許從其他豆莢傳遞包含標題。 文森特Isambart#3161

來源:Changelog