【发布时间】:2014-08-02 07:37:38
【问题描述】:
您好,我的项目文件夹结构如下:
+ Podfile
+ Apps/
|
+ Apps.xcodeproj
|
+ Target1/
|
+ Target2/
+ AppLib/
|
+ AppLib.podspec
|
+ AppLib.xcodeproj
|
+ TargetLib1/
|
+ TargetLib2/
我的依赖结构是这样的
Apps -- 依赖 --> AppLib
AppLib -- 依赖 --> RestKit 和 MagicalRecord
这是我如何配置我的 podfile
workspace 'MyApp'
xcodeproj 'Apps/Apps'
xcodeproj 'AppLib/AppLib'
def import_pods
pod 'AppLib', :path => './AppLib'
end
target 'Target1' do
platform :ios, '7.0'
import_pods
xcodeproj 'Apps/Apps'
end
target 'Target1' do
platform :ios, '7.0'
import_pods
xcodeproj 'Apps/Apps'
end
这里是AppLib.podspec:
Pod::Spec.new do |s|
s.name = "AppLib"
s.version = "0.0.1"
s.summary = "Common library."
s.platform = :ios, "7.0"
s.source_files = "Lib/Public/**/*.{h,m}"
s.ios.deployment_target = '7.0'
s.resources = "Lib/Nibs/**/*.xib"
s.requires_arc = true
s.dependency 'RestKit', '~> 0.23'
s.dependency 'MagicalRecord'
end
在根文件夹(文件夹包含 Podfile)pod install 运行没有问题
但是当我在我的 AppLibs 项目中导入 RestKit #import "RestKit.h" 或 #import <RestKit/RestKit.h> 时,xcode 说找不到该文件。
我的 podfile 和 podspec 是否正确? 为什么 xcode 声称没有找到 RestKit.h?
如果我想单独构建 AppLibs,如何拉取所有依赖项?
(pod install 不适用于 .podspec 文件)我需要在 AppLib 文件夹中创建另一个 podfile 吗?
【问题讨论】:
-
您可以尝试在您的 podspec 中添加“headers”部分,并在那里指定 RestKit 和 MagicalRecord 标头。虽然我认为 CocoaPods 应该自己处理这个问题
标签: xcode cocoa-touch cocoapods