我在 Xcode 5 上使用 Cocoapods 设置 OCMockito(和 OCHamcrest)时遇到问题。这是我的 Podfile:
platform :ios, '5.0'
pod 'RestKit', '~> 0.20.0'
pod 'OCMockito', '~> 1.0.0'
link_with ['WeatherApp', 'WeatherAppTests']
当我尝试遵循 iOS 项目设置 ( https://github.com/jonreid/OCMockito#adding-ocmockito-to-your-project ) 时,Xcode 找不到此导入:
#define HC_SHORTHAND
#import <OCHamcrestIOS/OCHamcrestIOS.h>
#define MOCKITO_SHORTHAND
#import <OCMockitoIOS/OCMockitoIOS.h>
所以我试着这样做:
#define HC_SHORTHAND
#import <OCHamcrest/OCHamcrest.h>
#define MOCKITO_SHORTHAND
#import <OCMockito/OCMockito.h>
它正在工作,但我不知道这是否很好。
另外,我还有一个问题。据我了解,我将 RestKit 和 OCMockito 链接到我的主要目标和测试目标。是否可以在两个目标上链接 RestKit 但仅将 OCMockito 链接到测试目标?
在此先感谢您的帮助。
更新:
这是 Cocoapods 的 Pods.xcconfig 基因:
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/OCHamcrest" "${PODS_ROOT}/Headers/OCMockito" "${PODS_ROOT}/Headers/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit" "${PODS_ROOT}/Headers/RestKit/RestKit/CoreData" "${PODS_ROOT}/Headers/RestKit/RestKit/Network" "${PODS_ROOT}/Headers/RestKit/RestKit/ObjectMapping" "${PODS_ROOT}/Headers/RestKit/RestKit/Support" "${PODS_ROOT}/Headers/SOCKit" "${PODS_ROOT}/Headers/TransitionKit"
OTHER_LDFLAGS = -ObjC -framework CFNetwork -framework CoreData -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration
PODS_ROOT = ${SRCROOT}/Pods
似乎 IOS 标头设置不正确,那么 pod 是否错误?
更新:
这是 Pods/Headers/OCMockito 的内容