我的 pod 文件如下所示:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'RestKit'
pod 'CocoaLumberjack'
在我的应用程序委托之上,我添加了:
#import <RestKit/RestKit.h>
In the 应用程序:didFinishLaunchingWithOptions:我添加了这个:
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[NSString class]];
到目前为止它编译得很好,然后我添加了:
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:[[NSURL alloc] initWithString:@"asdf"]];
再次,工作正常,然后我尝试了可达性:
[client setReachabilityStatusChangeBlock: ^(AFNetworkReachabilityStatus status)
{
NSLog(@"Reachability status changed");
}];
不幸的是,这无法编译并给出以下错误:
'AFHTTPClient' 没有可见的 @interface 声明选择器
'设置ReachabilityStatusChangeBlock:'
我去查了一下原因,发现这个方法的编译是由_SYSTEMCONFIGURATION_H
宏,由于某种原因在这种情况下解析为 false。
我尝试将我的项目链接到 SystemConfiguration 框架,但这没有帮助。我的假设是 RestKit 应该在编译时与其链接,当我检查 RestKit pod 时,SystemConfiguration 确实存在于 Link Binary with Libraries 阶段。有什么想法为什么这行不通吗?
Xcode7b5、cocoapods 0.38.2
可以找到示例项目here https://dl.dropboxusercontent.com/u/27427137/test1.zip.