【发布时间】:2015-09-29 21:18:30
【问题描述】:
在我的项目中,我引用了我公司使用的几个私有 pod。其中一个名为 DKKit 的 pod 依赖于我包含的另一个名为 BaseProKit 的私有 pod。 BaseProKit 包含它在其头文件和实现文件中引用的 3 个框架,我认为它们被认为是vendored_frameworks。在 BaseProKit 的现有头文件中,通过 #import <PPCommon/PPCommon> 之类的导入引用了这些框架,这些框架在仅依赖 BaseProKit pod 进行编译时工作得很好(通常)。但是,当包含 DKKit 时,DKKit 在导入 (BaseProKit.h) 时会查找包含上述导入的标题别名。但是,在 DKKit 的上下文中,DKKit pod 似乎不知道 PPCommon 框架的存在,它只能看到通过 Pods-BaseProKit 引用的头文件的别名。因此,对<PPCommon/ANYTHING> 的任何和所有引用都会产生编译错误(未找到),到目前为止我能够弄清楚的唯一方法是仅通过#import "PPCommon.h" 引用这将需要我调整所有整个 BaseProKit 项目中的导入,感觉不对。
我已包含以下文件以供参考: BaseProKit 的 Podspec:
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"
DKKit 的 Pod 规范:
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"
在我的任何一个 podspec 文件(特别是 BaseProKit 的文件)中,我有什么可以做的不同的事情,以确保这些框架可以在外部引用作为框架(而不仅仅是它们的头文件) Pod 本身?
将其复制到 Cocoapods/Cocoapods 存储库也是一个问题: https://github.com/CocoaPods/CocoaPods/issues/3810
【问题讨论】:
标签: objective-c frameworks cocoapods objective-c++