Skip to content

AFNetworking

Deprecated Objective-C networking library for Apple platforms; archived, no further releases.

Stars
33.3k
Forks
10.6k
Licence
MIT
Language
Objective-C
Last update
3.8 years ago
Type
Library

This repository is archived and no longer maintained.

What it is

AFNetworking is a networking library for iOS, macOS, watchOS, and tvOS apps. It wraps Apple's built-in URL loading system so app developers can send requests, download and upload files, and parse responses such as JSON or XML more easily. The project was archived on January 17, 2023 and is no longer maintained.

  • Create download tasks that save files to a chosen location
  • Create upload tasks, including multi-part form requests with progress
  • Serialize requests and parse JSON, XML, property list, or image responses
  • Check network reachability and configure SSL certificate pinning through AFSecurityPolicy

Great for

  • Maintaining an existing iOS or macOS app that already depends on AFNetworking
  • Developers who want to vendor and compile the source directly into a project
  • Teams reading legacy Objective-C code that uses AFNetworking APIs

Not ideal for

  • New projects: the README says it is deprecated and recommends Alamofire instead
  • Swift-first projects: the README points to Alamofire as the more conventional choice for Swift
  • Anyone needing security fixes or new platform support, since there will be no further releases

How to get it

  1. 1

    Install with a package manager

    You'll need: Xcode 11+ · CocoaPods, Swift Package Manager, or Carthage

    CocoaPods: add to Podfile

    pod 'AFNetworking', '~> 4.0'

    Swift Package Manager: add to Package.swift dependencies

    .package(url: "https://github.com/AFNetworking/AFNetworking.git", .upToNextMajor(from: "4.0.0"))

    Carthage: add to Cartfile

    github "AFNetworking/AFNetworking" ~> 4.0
  2. 2

    Run it

    • Add the dependency using one of the install methods above
    • Create an AFURLSessionManager or AFHTTPSessionManager with a session configuration
    • Build a request and call a task method such as downloadTaskWithRequest
    • Call resume on the task to start the request
  3. 3

    Get the most out of it

    • Use the Getting Started guide on the project wiki for setup details
    • Review the included Mac and iPhone example apps
    • Consider the README's guidance to copy the source into your project if you need full control
    • For new work, follow the README's migration path to Alamofire

Downloads

Strengths

  • Built on Apple's Foundation URL Loading System, so it extends familiar platform APIs
  • Modular set of classes for sessions, serialization, security, and reachability
  • MIT license allows copying and modifying the code

Trade-offs

  • Archived and deprecated, so it will receive no fixes or updates
  • Requires Xcode 11+ for the 4.x line and targets Objective-C rather than Swift

How it compares

ProjectStarsTypeLevelUpdatedBest for
AFNetworking (this)33.3kLibraryintermediate3.8 years agoMaintaining an existing iOS or macOS app that already depends on AFNetworking
Alamofire42.4kLibraryintermediate5 days agoSwift developers building iOS or macOS apps that call web APIs
Moya15.4kLibraryintermediate4 months agoSwift developers building iOS or macOS apps that call web APIs

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.