【发布时间】:2015-01-12 10:55:05
【问题描述】:
我正在编写一个使用外部库(如 Restkit)的 iOS 库。在我的库中一切正常,但是当我使用 Pods 将它导入其他项目时,只导入了我的源。这意味着我没有像 Restkit 这样的外部依赖项。
我在我的 podspec 文件中添加了:s.dependency 'Restkit' '~> 0.24.0'
但我看不出有什么不同。我感觉我错过了什么,有人可以帮我吗?
问候
编辑
SDK podspec 文件(重要部分):
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.source = { :git => "***************.git", :tag => "0.0.1" }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.source_files = "bee-ios-sdk/sdk", "bee-ios-sdk/sdk/**/*.{h,m}"
s.exclude_files = "bee-ios-sdk/sdk/Exclude"
# s.public_header_files = "Classes/**/*.h" # Maybe this ?
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
# s.requires_arc = true
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
s.dependency 'RestKit', '~> 0.24.0'
s.dependency 'CocoaSecurity'
还有我的应用程序中的 Podfile
target 'bee' do
pod 'bee-ios-sdk' # Private pod repository containing the podspec above
end
希望对你有帮助
编辑 2
$ pod install
Analyzing dependencies
Downloading dependencies
Installing bee-ios-sdk (0.0.1)
Generating Pods project
Integrating client project
如您所见,我只有我的来源。当我尝试构建时,没有发现 RestKit 和其他导致我找不到“RestKit/RestKit.h”文件错误的痕迹。在我的 App podfile 中添加我所有的 SDK 依赖项可以解决问题,但这显然并不性感。
我的 podfile 顶部没有源 'github.com/CocoaPods/Specs.git' 吗? 现在,我的 podfile (app) 请求一个私有 git repo,其中包含我的 sdk 的 url 的 .podspec 文件。我跟着这个tutorial 去做了。
【问题讨论】:
-
您可能需要包含您的 podspec 文件和您的 podfile
-
@DanielGalasko 你能说出你的意思吗?我应该在哪里/如何包含这些文件?我的 App Podfile 中只有 pod 'mySDK' 和运行 pod install download .h/m 文件,但没有在我的 SDK Podfile 中声明的依赖项。
-
是的,但是您编写了一个自定义 podspec,那么为什么不将它包含在帖子中呢? @MajorShepard
-
补充了一些信息,如果你需要更多,我会继续挖掘
-
好多了!您是否还可以在 Xcode 的文件导航器中列出 Pods 目录中的内容。只是想了解是什么导致您相信缺少依赖项