2015-07-11 101 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