AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of Foundation URL Loading System, extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac.
Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did!
How To Get Started
- Download AFNetworking and try out the included Mac and iPhone example apps
- Read the "Getting Started" guide, FAQ, or other articles in the wiki
- Check out the complete documentation for a comprehensive look at the APIs available in AFNetworking
- Watch the NSScreencast episode about AFNetworking for a quick introduction to how to use it in your application
- Questions? Stack Overflow is the best place to find answers
AFNetworking 2.0 is a major update to the framework. Building on 2 years of development, this new version introduces powerful new features, while providing an easy upgrade path for existing users.
Read the AFNetworking 2.0 Migration Guide for an overview of the architectural and API changes.
- Support for NSURLSession
- Serialization Modules
- Expanded UIKit Extensions
- Real-time functionality with Rocket
- Unit Tests Ported to 2.0
- AFSecurity Extension
- Core Image Serializer Extension
- MsgPack Serializer Extension
AFNetworking 2.0 and higher requires either iOS 7.0 and above, or Mac OS 10.9 Mavericks (64-bit with modern Cocoa runtime) and above.
For compatibility with iOS 5 & 6, use the latest 1.x release.
For compatibility with iOS 4.3, use the latest 0.10.x release.
AFNetworking includes a suite of unit tests within the Tests subdirectory. In order to run the unit tests, you must install the testing dependencies via CocoaPods. To do so:
$ gem install cocoapods # If necessary $ cd Tests $ pod install
Once CocoaPods has finished the installation, you can execute the test suite via the 'iOS Tests' and 'OS X Tests' schemes within Xcode.
By default, the unit tests do not emit any output during execution. For debugging purposes, it can be useful to enable logging of the requests and responses. Logging support is provided by the AFHTTPRequestOperationLogger extension, which is installed via CocoaPods into the test targets. To enable logging, edit the test Scheme and add an environment variable named
AFTestsLoggingEnabled with a value of
To install the commandline testing support via Homebrew:
$ brew update $ brew install xctool --HEAD
Once xctool is installed, you can execute the suite via
AFNetworking's logo was designed by Alan Defibaugh.
And most of all, thanks to AFNetworking's growing list of contributors.
Follow AFNetworking on Twitter (@AFNetworking)
AFNetworking is available under the MIT license. See the LICENSE file for more info.