For a project I have to use AFNetworking. Got fresh copy from github and the iOS example project seems to be working.
However - when I copy over the "AFNetworking" folder to a new Xcode project and try to make a http call, it crashes in the AFHTTPClient's initializer
So in [AFHTTPClient initWithBaseURL:] there's this code:
#ifdef _SYSTEMCONFIGURATION_H
[self startMonitoringNetworkReachability];
#endif
and it looks really stupid but
1) WHEN I don't link SystemConfiguration - the project doesn't compile
(Undefined symbols for architecture i386: "_SCNetworkReachabilityCreateWithName", referenced from: -[AFHTTPClient startMonitoringNetworkReachability] in AFHTTPClient.o)
2) WHEN I do link SystemConfiguration - the project crashes at runtime inside startMonitoringNetworkReachability with EXC_BAD_ACCESS:
SCNetworkReachabilitySetCallback(self.networkReachability, AFReachabilityCallback, &context);
Did anybody have this problem? From the way they praise their lib on github I thought it'd be more polished.
It will crash if your baseURL is nil.
As per the documentation:
This method requires the SystemConfiguration framework. Add it in the active target’s “Link Binary With Library” build phase, and add #import to the header prefix of the project (Prefix.pch).
You included the framework, but did you add #import <SystemConfiguration/SystemConfiguration.h>
somewhere in the project?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With