问题
My pod file looks like this:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
pod 'RestKit'
pod 'CocoaLumberjack'
On top of my App delegate I added:
#import <RestKit/RestKit.h>
In the application:didFinishLaunchingWithOptions: I added this:
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[NSString class]];
So far it compiles fine, then I added:
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:[[NSURL alloc] initWithString:@"asdf"]];
Again, works fine, then I tried the reachability:
[client setReachabilityStatusChangeBlock: ^(AFNetworkReachabilityStatus status)
{
NSLog(@"Reachability status changed");
}];
Unfortunately, this fails to compile and gives the following error:
no visible @interface for 'AFHTTPClient' declares the selector 'setReachabilityStatusChangeBlock:'
I went to check why that might be, and found that the compilation of this method is guarded by _SYSTEMCONFIGURATION_H
macro, which for some reason resolves to false in this case.
I tried to link my project against the SystemConfiguration framework, but it doesn't help. My assumption is that the RestKit should be linked with it at compile time, and when I checked the RestKit pod, the SystemConfiguration is indeed present in the Link Binary with Libraries phase. Any ideas why this doesn't work?
Xcode7b5, cocoapods 0.38.2 Sample project can be found here.
来源:https://stackoverflow.com/questions/31939494/restkit-with-cocoapod-with-use-frameworks-cant-use-afnetworkreachability