AFNetworking 2.0 was announced last week. But I find different requirements for AFNetworking 2.0.
README.md tells it requires either iOS 7.0 and above, while AFNetworking 2.0 Migration Guide tells it requires either iOS 6.0 and above.
Dose AFNetworking 2.0 support iOS 6.0?
Accoding to the CocoaPods podspec, you can simply use AFN 2.0 but not include the NSURLSession
related files.
For example if you use CocoaPods (if you don't, you should really consider doing it, it's awesome!), simply use this on your Podfile to get AFN 2.0 without NSURLSession
-related features:
pod 'AFNetworking', '~> 2.0'
This will only get the "Core"
subspec, which supports the deployment target 6.0 for iOS (s.ios.deployment_target = '6.0'
in the podspec) and does not integrate NSURLSession
-related files. So this will be compatible with your project using an iOS6 or greater deployment target.
If you later wish to drop the 6.0 support on your project and take advantage of the NSURLSession
capabilities, you can add the NSURLSession
subspec to your Podfile
:
pod 'AFNetworking', '~> 2.0' # Core, without NSURLSession, compatible with iOS6
pod 'AFNetworking/NSURLSession', '~> 2.0' # Add NSURLSession features, only compatible with iOS7
You can see in the podspec
that adding the NSURLSession
subspec will add the s.ios.deployment_target = '7.0'
requirement as a consequence, requiring your project's deployment target to be 7.0 or greater too of course, as you could expect.
[EDIT] Since my answer, Mattt updated its code and podspec so that you can get the NSURLSession
subspec even when targeting iOS6. See this pull request on its github (and other ones related).
So now you can get the NSURLSession
subspec even for you iOS6-min projects, and just conditionally call them at runtime only if ([NSURLSession class])
is true.
AFNetworking 2.0 is supported in iOS 6. My problem was that I had previously installed it with the platform set to iOS 7. I fixed it by doing this:
Podfile
pod install
, which deleted all my pods.Podfile
, with platform :ios, '6.0'
And I was able to still use my existing AFNetworking code with no problems.
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