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

Installation with CocoaPods

platform :ios, '7.0'
pod "AFNetworking", "2.0RC1"


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.

What's New

  • Support for NSURLSession
  • Serialization Modules
  • Expanded UIKit Extensions
  • Real-time functionality with Rocket

Coming Soon

  • Complete & Updated Documentation
  • Unit Tests Ported to 2.0
  • Migration Guide from 1.x
  • Proper Modularization with Sub-Specs


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.

Unit Tests

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.

Test Logging

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 YES.

Using xctool

If you wish to execute the tests from the command line or within a continuous integration environment, you will need to install xctool. The recommended installation method is Homebrew.

To install the commandline testing support via Homebrew:

$ brew update
$ brew install xctool --HEAD

Once xctool is installed, you can execute the suite via rake test.


AFNetworking was created by Scott Raymond and Mattt Thompson in the development of Gowalla for iPhone.

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)


Mattt Thompson @mattt

Scott Raymond @sco


AFNetworking is available under the MIT license. See the LICENSE file for more info.