A delightful networking framework for iOS, macOS, watchOS, and tvOS.

Overview

AFNetworking

Build Status CocoaPods Compatible Carthage Compatible Platform Twitter

AFNetworking is a delightful networking library for iOS, macOS, watchOS, and tvOS. It's built on top of the 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.

How To Get Started

Communication

  • If you need help, use Stack Overflow. (Tag 'afnetworking')
  • If you'd like to ask a general question, use Stack Overflow.
  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation

AFNetworking supports multiple methods for installing the library in a project.

Installation with CocoaPods

To integrate AFNetworking into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'AFNetworking', '~> 4.0'

Installation with Swift Package Manager

Once you have your Swift package set up, adding AFNetworking as a dependency is as easy as adding it to the dependencies value of your Package.swift.

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

Note: AFNetworking's Swift package does not include it's UIKit extensions.

Installation with Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate AFNetworking, add the following to your Cartfile.

github "AFNetworking/AFNetworking" ~> 4.0

Requirements

AFNetworking Version Minimum iOS Target Minimum macOS Target Minimum watchOS Target Minimum tvOS Target Notes
4.x iOS 9 macOS 10.10 watchOS 2.0 tvOS 9.0 Xcode 11+ is required.
3.x iOS 7 OS X 10.9 watchOS 2.0 tvOS 9.0 Xcode 7+ is required. NSURLConnectionOperation support has been removed.
2.6 -> 2.6.3 iOS 7 OS X 10.9 watchOS 2.0 n/a Xcode 7+ is required.
2.0 -> 2.5.4 iOS 6 OS X 10.8 n/a n/a Xcode 5+ is required. NSURLSession subspec requires iOS 7 or OS X 10.9.
1.x iOS 5 Mac OS X 10.7 n/a n/a
0.10.x iOS 4 Mac OS X 10.6 n/a n/a

(macOS projects must support 64-bit with modern Cocoa runtime).

Programming in Swift? Try Alamofire for a more conventional set of APIs.

Architecture

NSURLSession

  • AFURLSessionManager
  • AFHTTPSessionManager

Serialization

  • <AFURLRequestSerialization>
    • AFHTTPRequestSerializer
    • AFJSONRequestSerializer
    • AFPropertyListRequestSerializer
  • <AFURLResponseSerialization>
    • AFHTTPResponseSerializer
    • AFJSONResponseSerializer
    • AFXMLParserResponseSerializer
    • AFXMLDocumentResponseSerializer (macOS)
    • AFPropertyListResponseSerializer
    • AFImageResponseSerializer
    • AFCompoundResponseSerializer

Additional Functionality

  • AFSecurityPolicy
  • AFNetworkReachabilityManager

Usage

AFURLSessionManager

AFURLSessionManager creates and manages an NSURLSession object based on a specified NSURLSessionConfiguration object, which conforms to <NSURLSessionTaskDelegate>, <NSURLSessionDataDelegate>, <NSURLSessionDownloadDelegate>, and <NSURLSessionDelegate>.

Creating a Download Task

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];

NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) {
    NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
    return [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]];
} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) {
    NSLog(@"File downloaded to: %@", filePath);
}];
[downloadTask resume];

Creating an Upload Task

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];

NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"];
NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
    if (error) {
        NSLog(@"Error: %@", error);
    } else {
        NSLog(@"Success: %@ %@", response, responseObject);
    }
}];
[uploadTask resume];

Creating an Upload Task for a Multi-Part Request, with Progress

NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
        [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"file://path/to/image.jpg"] name:@"file" fileName:@"filename.jpg" mimeType:@"image/jpeg" error:nil];
    } error:nil];

AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]];

NSURLSessionUploadTask *uploadTask;
uploadTask = [manager
              uploadTaskWithStreamedRequest:request
              progress:^(NSProgress * _Nonnull uploadProgress) {
                  // This is not called back on the main queue.
                  // You are responsible for dispatching to the main queue for UI updates
                  dispatch_async(dispatch_get_main_queue(), ^{
                      //Update the progress view
                      [progressView setProgress:uploadProgress.fractionCompleted];
                  });
              }
              completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
                  if (error) {
                      NSLog(@"Error: %@", error);
                  } else {
                      NSLog(@"%@ %@", response, responseObject);
                  }
              }];

[uploadTask resume];

Creating a Data Task

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];

NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
    if (error) {
        NSLog(@"Error: %@", error);
    } else {
        NSLog(@"%@ %@", response, responseObject);
    }
}];
[dataTask resume];

Request Serialization

Request serializers create requests from URL strings, encoding parameters as either a query string or HTTP body.

NSString *URLString = @"http://example.com";
NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]};

Query String Parameter Encoding

[[AFHTTPRequestSerializer serializer] requestWithMethod:@"GET" URLString:URLString parameters:parameters error:nil];
GET http://example.com?foo=bar&baz[]=1&baz[]=2&baz[]=3

URL Form Parameter Encoding

[[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil];
POST http://example.com/
Content-Type: application/x-www-form-urlencoded

foo=bar&baz[]=1&baz[]=2&baz[]=3

JSON Parameter Encoding

[[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil];
POST http://example.com/
Content-Type: application/json

{"foo": "bar", "baz": [1,2,3]}

Network Reachability Manager

AFNetworkReachabilityManager monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.

  • Do not use Reachability to determine if the original request should be sent.
    • You should try to send it.
  • You can use Reachability to determine when a request should be automatically retried.
    • Although it may still fail, a Reachability notification that the connectivity is available is a good time to retry something.
  • Network reachability is a useful tool for determining why a request might have failed.
    • After a network request has failed, telling the user they're offline is better than giving them a more technical but accurate error, such as "request timed out."

See also WWDC 2012 session 706, "Networking Best Practices.".

Shared Network Reachability

[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
    NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status));
}];

[[AFNetworkReachabilityManager sharedManager] startMonitoring];

Security Policy

AFSecurityPolicy evaluates server trust against pinned X.509 certificates and public keys over secure connections.

Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.

Allowing Invalid SSL Certificates

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production

Unit Tests

AFNetworking includes a suite of unit tests within the Tests subdirectory. These tests can be run simply be executed the test action on the platform framework you would like to test.

Credits

AFNetworking is owned and maintained by the Alamofire Software Foundation.

AFNetworking was originally 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.

Security Disclosure

If you believe you have identified a security vulnerability with AFNetworking, you should report it as soon as possible via email to [email protected]. Please do not post it to a public issue tracker.

License

AFNetworking is released under the MIT license. See LICENSE for details.

Comments
  • Success and Failure blocks sometimes not called

    Success and Failure blocks sometimes not called

    I'm using AFJSONRequestOperation, and most of the time everything works fine. But sometimes neither the success block nor the failure blocked gets called. What happens when the HTTP call times out? Does the failure block get called? Or does the operation just silently fail?

    opened by FirstSOW 145
  • The operation couldn’t be completed only in Wifi with POST method under iOS 8

    The operation couldn’t be completed only in Wifi with POST method under iOS 8

    I'm having some very weird issues with iOS 8. It never happens under iOS 7, and it only happens on iOS 8 on Wifi (tested with 3 different network) but not on cellular network. Around 2/3 of my POST Request fail, with an "Operation couldn't be completed" error.

    I tried debugging it, server side, client side. It seems like the failing request never leave the iPhone, it goes directly to the didFail delegate with an error.

    Here is the full error message

    Error Domain=NSURLErrorDomain Code=-1005 "The operation couldn’t be completed. (NSURLErrorDomain error -1005.)" UserInfo=0x7feb814388a0 {NSErrorFailingURLStringKey=[removeURL], NSErrorFailingURLKey=[removedURL], _kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-4, NSUnderlyingError=0x7feb81456750 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1005.)"
    

    I think this SO question is kinda linked, it sound like it's a mix between the configuration of the application, AFNetworking and some iOS weirdness... http://stackoverflow.com/questions/25372318/error-domain-nsurlerrordomain-code-1005-the-network-connection-was-lost

    opened by Dimillian 94
  • EXC_BAD_ACCESS exception

    EXC_BAD_ACCESS exception

    I have a thread that is crashing in CFDictionaryGetValue

    The stack trace for the thread that is causing the exception is as follows:

    * thread #10: tid = 0x9f8aa, 0x302ed04a CoreFoundation`CFDictionaryGetValue + 10, queue = 'NSOperationQueue 0x16d835c0, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        frame #0: 0x302ed04a CoreFoundation`CFDictionaryGetValue + 10
        frame #1: 0x30d37438 Foundation`_NSSetIntValueAndNotify + 48
        frame #2: 0x30041168 CFNetwork`__55-[__NSCFURLSession delegate_task:didCompleteWithError:]_block_invoke + 28
        frame #3: 0x30cfd7ce Foundation`-[NSBlockOperation main] + 130
        frame #4: 0x30ced97a Foundation`-[__NSOperationInternal _start:] + 770
        frame #5: 0x30d91b34 Foundation`__NSOQSchedule_f + 60
        frame #6: 0x3afd66de libdispatch.dylib`_dispatch_async_redirect_invoke$VARIANT$mp + 110
        frame #7: 0x3afd7da4 libdispatch.dylib`_dispatch_root_queue_drain + 220
        frame #8: 0x3afd7f8c libdispatch.dylib`_dispatch_worker_thread2 + 56
        frame #9: 0x3b112dbe libsystem_pthread.dylib`_pthread_wqthread + 298
    
    The stack trace for all threads are:
    
    thread #1: tid = 0xa06fd, 0x3b099a8c libsystem_kernel.dylib`mach_msg_trap + 20, queue = 'com.apple.main-thread
        frame #0: 0x3b099a8c libsystem_kernel.dylib`mach_msg_trap + 20
        frame #1: 0x3b09988c libsystem_kernel.dylib`mach_msg + 48
        frame #2: 0x3038a7ca CoreFoundation`__CFRunLoopServiceMachPort + 154
        frame #3: 0x30388f36 CoreFoundation`__CFRunLoopRun + 854
        frame #4: 0x302f3ce6 CoreFoundation`CFRunLoopRunSpecific + 522
        frame #5: 0x302f3aca CoreFoundation`CFRunLoopRunInMode + 106
        frame #6: 0x34fe1282 GraphicsServices`GSEventRunModal + 138
        frame #7: 0x32b95a40 UIKit`UIApplicationMain + 1136
        frame #8: 0x00075864 MyProduct`main(argc=1, argv=0x27d94d04) + 116 at main.m:16
    
      thread #2: tid = 0xa070e, 0x3b09983c libsystem_kernel.dylib`kevent64 + 24, queue = 'com.apple.libdispatch-manager
        frame #0: 0x3b09983c libsystem_kernel.dylib`kevent64 + 24
        frame #1: 0x3afda224 libdispatch.dylib`_dispatch_mgr_invoke + 232
        frame #2: 0x3afd9faa libdispatch.dylib`_dispatch_mgr_thread$VARIANT$mp + 38
    
      thread #6: tid = 0xa0713, 0x3b099a8c libsystem_kernel.dylib`mach_msg_trap + 20, name = 'com.apple.NSURLConnectionLoader
        frame #0: 0x3b099a8c libsystem_kernel.dylib`mach_msg_trap + 20
        frame #1: 0x3b09988c libsystem_kernel.dylib`mach_msg + 48
        frame #2: 0x3038a7ca CoreFoundation`__CFRunLoopServiceMachPort + 154
        frame #3: 0x30388ef0 CoreFoundation`__CFRunLoopRun + 784
        frame #4: 0x302f3ce6 CoreFoundation`CFRunLoopRunSpecific + 522
        frame #5: 0x302f3aca CoreFoundation`CFRunLoopRunInMode + 106
        frame #6: 0x30d2d496 Foundation`+[NSURLConnection(Loader) _resourceLoadLoop:] + 318
        frame #7: 0x30da2e26 Foundation`__NSThread__main__ + 1062
        frame #8: 0x3b114c1c libsystem_pthread.dylib`_pthread_body + 140
        frame #9: 0x3b114b8e libsystem_pthread.dylib`_pthread_start + 102
    
      thread #7: tid = 0xa0717, 0x3b0ac440 libsystem_kernel.dylib`select$DARWIN_EXTSN + 20, name = 'com.apple.CFSocket.private
        frame #0: 0x3b0ac440 libsystem_kernel.dylib`select$DARWIN_EXTSN + 20
        frame #1: 0x3038e68c CoreFoundation`__CFSocketManager + 484
        frame #2: 0x3b114c1c libsystem_pthread.dylib`_pthread_body + 140
        frame #3: 0x3b114b8e libsystem_pthread.dylib`_pthread_start + 102
    
      thread #24: tid = 0xa0c20, 0x3b0abf38 libsystem_kernel.dylib`__psynch_cvwait + 24, queue = 'NSOperationQueue Serial Queue
        frame #0: 0x3b0abf38 libsystem_kernel.dylib`__psynch_cvwait + 24
        frame #1: 0x3b114228 libsystem_pthread.dylib`_pthread_cond_wait + 540
        frame #2: 0x3b115004 libsystem_pthread.dylib`pthread_cond_wait + 40
        frame #3: 0x30d8ed10 Foundation`-[__NSOperationInternal _waitUntilFinished:] + 84
        frame #4: 0x30cfd7ce Foundation`-[NSBlockOperation main] + 130
        frame #5: 0x30ced97a Foundation`-[__NSOperationInternal _start:] + 770
        frame #6: 0x30d91b34 Foundation`__NSOQSchedule_f + 60
        frame #7: 0x3afd7296 libdispatch.dylib`_dispatch_queue_drain$VARIANT$mp + 374
        frame #8: 0x3afd709a libdispatch.dylib`_dispatch_queue_invoke$VARIANT$mp + 42
        frame #9: 0x3afd7d14 libdispatch.dylib`_dispatch_root_queue_drain + 76
        frame #10: 0x3afd7f8c libdispatch.dylib`_dispatch_worker_thread2 + 56
        frame #11: 0x3b112dbe libsystem_pthread.dylib`_pthread_wqthread + 298
    
      thread #25: tid = 0xa0c25, 0x3b112c7c libsystem_pthread.dylib`start_wqthread
        frame #0: 0x3b112c7c libsystem_pthread.dylib`start_wqthread
    
      thread #29: tid = 0xa0e39, 0x3b09983c libsystem_kernel.dylib`kevent64 + 24, queue = 'com.apple.NSURLSession-work
        frame #0: 0x3b09983c libsystem_kernel.dylib`kevent64 + 24
        frame #1: 0x3afd9ee6 libdispatch.dylib`_dispatch_kq_update + 190
        frame #2: 0x3afd9e24 libdispatch.dylib`_dispatch_mgr_wakeup$VARIANT$mp + 44
        frame #3: 0x3afd6762 libdispatch.dylib`_dispatch_wakeup$VARIANT$mp + 22
        frame #4: 0x3afd6f40 libdispatch.dylib`_dispatch_queue_push_list_slow2 + 20
        frame #5: 0x3afd7258 libdispatch.dylib`_dispatch_queue_drain$VARIANT$mp + 312
        frame #6: 0x3afd709a libdispatch.dylib`_dispatch_queue_invoke$VARIANT$mp + 42
        frame #7: 0x3afd7d14 libdispatch.dylib`_dispatch_root_queue_drain + 76
        frame #8: 0x3afd7f8c libdispatch.dylib`_dispatch_worker_thread2 + 56
        frame #9: 0x3b112dbe libsystem_pthread.dylib`_pthread_wqthread + 298
    
    * thread #31: tid = 0xa0ed0, 0x302ed04a CoreFoundation`CFDictionaryGetValue + 10, queue = 'NSOperationQueue 0x15e32510, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
        frame #0: 0x302ed04a CoreFoundation`CFDictionaryGetValue + 10
        frame #1: 0x30d37438 Foundation`_NSSetIntValueAndNotify + 48
        frame #2: 0x30041168 CFNetwork`__55-[__NSCFURLSession delegate_task:didCompleteWithError:]_block_invoke + 28
        frame #3: 0x30cfd7ce Foundation`-[NSBlockOperation main] + 130
        frame #4: 0x30ced97a Foundation`-[__NSOperationInternal _start:] + 770
        frame #5: 0x30d91b34 Foundation`__NSOQSchedule_f + 60
        frame #6: 0x3afd66de libdispatch.dylib`_dispatch_async_redirect_invoke$VARIANT$mp + 110
        frame #7: 0x3afd7da4 libdispatch.dylib`_dispatch_root_queue_drain + 220
        frame #8: 0x3afd7f8c libdispatch.dylib`_dispatch_worker_thread2 + 56
        frame #9: 0x3b112dbe libsystem_pthread.dylib`_pthread_wqthread + 298
    
      thread #32: tid = 0xa0f01, 0x3b112c7c libsystem_pthread.dylib`start_wqthread
        frame #0: 0x3b112c7c libsystem_pthread.dylib`start_wqthread
    

    The code that is crashing looks like this:

    /* Simple polling - with a 1 sec delay between polls */
    - (void) startPolling
    {
        NSLog(@"%@", @"Begin getStatusForZone");
        [ws getStatusForZone:currentZone
         success:^(NSURLSessionDataTask *task, NSDictionary *__autoreleasing zStatus) {
    
             NSLog(@"%@", @"Complete getStatusForZone");
    
             // Wait then poll again
             if (isPolling) {
                 [self performSelector:@selector(startPolling) withObject:nil afterDelay:1.0];
             }
         }
         failure:^(NSURLSessionDataTask *task, NSError *error)
         {
             NSLog(@"%@", @"Failed getStatusForZone");
    
             // Wait then poll again
             if (isPolling) {
                 [self performSelector:@selector(startPolling) withObject:nil afterDelay:1.0];
             }
         }];
    }
    

    I can provide more information as needed.

    Any suggestions how I can determine the cause?

    Thanks

    opened by Dkrinker 93
  • [iOS 12 Beta 11] NSPOSIXErrorDomain Code=53: Software caused connection abort

    [iOS 12 Beta 11] NSPOSIXErrorDomain Code=53: Software caused connection abort

    I'm experiencing this issue in iOS 12 Beta 11 using last version of the framework (3.2.1). The complete error localised description is:

    HTTP load failed (error code: 53 [1:53])
    2018-08-30 11:54:43.390749+0200 Background[2224:809685] Task <7CD7B0DD-2CE2-400D-AC02-D66C0F4E4847>.<7> finished with error - code: 53
    2018-08-30 11:54:43.391271+0200 Background[2224:809125] Task <7CD7B0DD-2CE2-400D-AC02-D66C0F4E4847>.<7> load failed with error Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort" UserInfo={_NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <7CD7B0DD-2CE2-400D-AC02-D66C0F4E4847>.<7>, _kCFStreamErrorDomainKey=1, _NSURLErrorRelatedURLSessionTaskErrorKey=(
        "LocalDataTask <7CD7B0DD-2CE2-400D-AC02-D66C0F4E4847>.<7>"
    ), _kCFStreamErrorCodeKey=53} [53]
    failure The operation couldn’t be completed. Software caused connection abort
    

    The bug is easy to reproduce: you have just to put the application in background, wait for few seconds and restore it to foreground state.

    I've reproduced it in a blank application, that I'm attaching there.

    Feel free to ask if you have any doubts :) Giovanni Background.zip

    stale 
    opened by Gioevi90 80
  • Random Error Domain=NSURLErrorDomain Code=-1003

    Random Error Domain=NSURLErrorDomain Code=-1003

    Not sure what the deal is with this. I arbitrarily get this error:

    Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found."

    Reachability hasn't changed at that point, and a successful request will come before and after this. The hostname definitely isn't going away. I can hit the url for eternity and repeatedly with curl.

    opened by bobspryn 71
  • POST method does not send Content-Length

    POST method does not send Content-Length

    I tried to upload some small chunk of data to Amazon S3 with this request:

    - (void)uploadUserAvatarImae:(NSData *)image
                             url:(NSURL *)url
                          params:(NSDictionary *)params
                         success:(void(^)(void))success
                         failure:(void(^)(NSError *error))failure {
      __block AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:url];
      [sessionManager POST:@""
                parameters:params
                                                constructingBodyWithBlock:^(id < AFMultipartFormData > formData) {
                                                  [formData appendPartWithFormData:image name:@"file"];
                                                }
                                                success:^(NSURLSessionDataTask *task, id responseObject) {
                                                  NSLog( @"Upload response: %@", responseObject );
                                                  TM_CALL_BLOCK( success );
                                                  sessionManager = nil;
                                                }
                                                failure:^(NSURLSessionDataTask *task, NSError *error) {
                                                  TM_CALL_BLOCK( failure, error );
                                                  sessionManager = nil;
                                                }];
    }
    

    ... url is my S3 bucket URL, params does contain credentials, etc. This gives me 411 - content-length required. Serializer creates correct request (see attached image). But when you do create NSURLSessionDataTask at line 191 in AFHTTPSessionManager (POST:... method) you do call [self dataTaskWithRequest:completionHandler:] and this method does call dataTaskWithRequest: of NSURLSession. According to documentation, dataTaskWithRequest: creates GET request. It's probably the reason why Content-Length is removed from this request.

    screen shot 2013-09-30 at 20 26 26

    opened by zrzka 63
  • HTTPClient -> AFHTTPSessionManager | Response body on error?

    HTTPClient -> AFHTTPSessionManager | Response body on error?

    I used to retrieve the json response body with HTTPClient using [(AFJSONRequestOperation*)operation responseJSON]

    After migrating to 2.0, I have not found a way to do so. Am I missing something?

    Thanks

    opened by devmod 61
  • File upload is broken

    File upload is broken

    Hi guys,

    I am using RestKit to work with my server. As you may know they are using AFN to send requests to server. Today I have found that my file upload is broken. I was playing around and reverting AFN commits one by one to find the place where file upload was broken.

    I have found that commit f7d98aac9cd615eab4d70d6826f4ce907514dcf6 causes that issue. I am not sure what is happening but I can see next log:

    2013-04-26 12:28:27.888 Mileways[18944:c07] T restkit.network:RKHTTPRequestOperation.m:152 POST 'http://data.mileways.com/v097/test/':
    request.headers={
        Accept = "application/json";
        "Accept-Language" = "en;q=1, ru;q=0.9, fr;q=0.8, de;q=0.7, ja;q=0.6, nl;q=0.5";
        "Content-Length" = 245745;
        "Content-Type" = "multipart/form-data; boundary=Boundary+0xAbCdEfGbOuNdArY";
        "User-Agent" = "Test (iPhone Simulator; iOS 6.1; Scale/2.00)";
    }
    request.body=<__NSCFInputStream: 0x220a9d00 hasBytesAvailable=NO, status='Not Open'>
    2013-04-26 12:28:27.888 Mileways[18944:c07] Sent 4096 of 245745 bytes
    2013-04-26 12:28:27.889 Mileways[18944:c07] Sent 8192 of 245745 bytes
    2013-04-26 12:28:27.889 Mileways[18944:5703] Stream 0x220a9d00 is sending an event before being opened
    2013-04-26 12:28:27.889 Mileways[18944:5703] Stream 0x220a9d00 is sending an event before being opened
    2013-04-26 12:29:27.889 Mileways[18944:c07] E restkit.network:RKHTTPRequestOperation.m:173 POST 'http://data.mileways.com/v097/test/' (0) [60.0011 s]:
    error=Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1cdaa140 {NSErrorFailingURLStringKey=http://data.mileways.com/v097/test/, NSErrorFailingURLKey=http://data.mileways.com/v097/test/, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x220aaf00 "The request timed out."}
        response.body=(null)
    2013-04-26 12:29:27.889 Mileways[18944:a04f] E restkit.network:RKObjectRequestOperation.m:346 Object request failed: Underlying HTTP request operation failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1cdaa140 {NSErrorFailingURLStringKey=http://data.mileways.com/v097/test/, NSErrorFailingURLKey=http://data.mileways.com/v097/test/, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x220aaf00 "The request timed out."}
    2013-04-26 12:29:27.890 Mileways[18944:c07] E app:FlightDetailsViewController.m:1025 Failed to upload photo: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1cdaa140 {NSErrorFailingURLStringKey=http://data.mileways.com/v097/test/, NSErrorFailingURLKey=http://data.mileways.com/v097/test/, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x220aaf00 "The request timed out."}
    

    In the log you can find test url that you can use to reproduce the issue. I am sending small png image and with one parameter: hide=0.

    And this is log when I am running the same code after reverting to 9b2a20c0a130104b2e792ab62b6c8cc8238323f1

    2013-04-26 12:36:48.583 Mileways[19387:c07] T restkit.network:RKHTTPRequestOperation.m:152 POST 'http://data.mileways.com/v097/test/':
    request.headers={
        Accept = "application/json";
        "Accept-Language" = "en;q=1, ru;q=0.9, fr;q=0.8, de;q=0.7, ja;q=0.6, nl;q=0.5";
        "Content-Length" = 245745;
        "Content-Type" = "multipart/form-data; boundary=Boundary+0xAbCdEfGbOuNdArY";
        "User-Agent" = "Test (iPhone Simulator; iOS 6.1; Scale/2.00)";
    }
    request.body=<__NSCFInputStream: 0x16a0f770 hasBytesAvailable=NO, status='Not Open'>
    2013-04-26 12:36:48.702 Mileways[19387:c07] Sent 32768 of 245745 bytes
    2013-04-26 12:36:48.703 Mileways[19387:c07] Sent 65536 of 245745 bytes
    2013-04-26 12:36:48.703 Mileways[19387:c07] Sent 98304 of 245745 bytes
    2013-04-26 12:36:48.703 Mileways[19387:c07] Sent 131072 of 245745 bytes
    2013-04-26 12:36:48.942 Mileways[19387:c07] Sent 133216 of 245745 bytes
    2013-04-26 12:36:49.061 Mileways[19387:c07] Sent 136112 of 245745 bytes
    2013-04-26 12:36:49.121 Mileways[19387:c07] Sent 139008 of 245745 bytes
    2013-04-26 12:36:49.158 Mileways[19387:c07] Sent 141904 of 245745 bytes
    2013-04-26 12:36:49.270 Mileways[19387:c07] Sent 144800 of 245745 bytes
    2013-04-26 12:36:49.312 Mileways[19387:c07] Sent 147696 of 245745 bytes
    2013-04-26 12:36:49.370 Mileways[19387:c07] Sent 150592 of 245745 bytes
    2013-04-26 12:36:49.404 Mileways[19387:c07] Sent 153488 of 245745 bytes
    2013-04-26 12:36:49.431 Mileways[19387:c07] Sent 156384 of 245745 bytes
    2013-04-26 12:36:49.548 Mileways[19387:c07] Sent 159280 of 245745 bytes
    2013-04-26 12:36:49.575 Mileways[19387:c07] Sent 162176 of 245745 bytes
    2013-04-26 12:36:49.641 Mileways[19387:c07] Sent 163840 of 245745 bytes
    2013-04-26 12:36:49.688 Mileways[19387:c07] Sent 169416 of 245745 bytes
    2013-04-26 12:36:49.722 Mileways[19387:c07] Sent 172312 of 245745 bytes
    2013-04-26 12:36:49.776 Mileways[19387:c07] Sent 175208 of 245745 bytes
    2013-04-26 12:36:49.811 Mileways[19387:c07] Sent 178104 of 245745 bytes
    2013-04-26 12:36:49.842 Mileways[19387:c07] Sent 181000 of 245745 bytes
    2013-04-26 12:36:49.918 Mileways[19387:c07] Sent 183896 of 245745 bytes
    2013-04-26 12:36:49.923 Mileways[19387:c07] Sent 186792 of 245745 bytes
    2013-04-26 12:36:49.975 Mileways[19387:c07] Sent 189688 of 245745 bytes
    2013-04-26 12:36:50.011 Mileways[19387:c07] Sent 192584 of 245745 bytes
    2013-04-26 12:36:50.048 Mileways[19387:c07] Sent 195480 of 245745 bytes
    2013-04-26 12:36:50.123 Mileways[19387:c07] Sent 196608 of 245745 bytes
    2013-04-26 12:36:50.150 Mileways[19387:c07] Sent 201272 of 245745 bytes
    2013-04-26 12:36:50.191 Mileways[19387:c07] Sent 204168 of 245745 bytes
    2013-04-26 12:36:50.271 Mileways[19387:c07] Sent 208512 of 245745 bytes
    2013-04-26 12:36:50.318 Mileways[19387:c07] Sent 211408 of 245745 bytes
    2013-04-26 12:36:50.375 Mileways[19387:c07] Sent 214304 of 245745 bytes
    2013-04-26 12:36:50.390 Mileways[19387:c07] Sent 217200 of 245745 bytes
    2013-04-26 12:36:50.451 Mileways[19387:c07] Sent 220096 of 245745 bytes
    2013-04-26 12:36:50.474 Mileways[19387:c07] Sent 222992 of 245745 bytes
    2013-04-26 12:36:50.485 Mileways[19387:c07] Sent 225888 of 245745 bytes
    2013-04-26 12:36:50.548 Mileways[19387:c07] Sent 228784 of 245745 bytes
    2013-04-26 12:36:50.588 Mileways[19387:c07] Sent 229376 of 245745 bytes
    2013-04-26 12:36:50.589 Mileways[19387:c07] Sent 231680 of 245745 bytes
    2013-04-26 12:36:50.605 Mileways[19387:c07] Sent 234576 of 245745 bytes
    2013-04-26 12:36:50.668 Mileways[19387:c07] Sent 237472 of 245745 bytes
    2013-04-26 12:36:50.690 Mileways[19387:c07] Sent 240368 of 245745 bytes
    2013-04-26 12:36:50.725 Mileways[19387:c07] Sent 243264 of 245745 bytes
    2013-04-26 12:36:50.808 Mileways[19387:c07] Sent 245745 of 245745 bytes
    2013-04-26 12:36:52.461 Mileways[19387:c07] T restkit.network:RKHTTPRequestOperation.m:183 POST 'http://data.mileways.com/v097/test/' (200 OK) [3.8786 s]:
    response.headers={
        "Access-Control-Allow-Origin" = "*";
        "Cache-Control" = "private, no-cache, no-store, must-revalidate";
        Connection = "Keep-Alive";
        "Content-Length" = 284;
        "Content-Type" = "application/json; charset=UTF-8";
        Date = "Fri, 26 Apr 2013 08:36:48 GMT";
        Expires = "Mon, 26 Jul 1997 05:00:00 GMT";
        "Keep-Alive" = "timeout=5, max=100";
        Pragma = "no-cache";
        Server = Apache;
    }
    response.body={
        "hide": "0",
        "session": "<><><>",
        "picture": {
            "name": "photo.png",
            "type": "image\/png",
            "tmp_name": "\/is\/htdocs\/user_tmp\/wp11076254_TYZRNXHENH\/phptQL2eD",
            "error": "0",
            "size": "245358"
        }
    }
    

    Thanks

    opened by ExtremeMan 61
  • Feature/wk web view

    Feature/wk web view

    This PR leverages the previous #4430 from @Tripwire999

    We have updated the httpbin.org certificate and its trust chain certificates. We have updated the [AFWKWebView testProgressIsSet] test to use a large download URL.

    opened by tjanela 54
  • Current implementation of batch completion block firing after all dependent completion blocks doesn't work for AFJSONRequestOperations.

    Current implementation of batch completion block firing after all dependent completion blocks doesn't work for AFJSONRequestOperations.

    The following implementation:

    - (void)enqueueBatchOfHTTPRequestOperations:(NSArray *)operations 
                                  progressBlock:(void (^)(NSUInteger numberOfCompletedOperations, NSUInteger totalNumberOfOperations))progressBlock 
                                completionBlock:(void (^)(NSArray *operations))completionBlock
    {    
        __block dispatch_group_t dispatchGroup = dispatch_group_create();
        dispatch_retain(dispatchGroup);
        NSBlockOperation *batchedOperation = [NSBlockOperation blockOperationWithBlock:^{
            dispatch_group_notify(dispatchGroup, dispatch_get_main_queue(), ^{
                if (completionBlock) {
                    completionBlock(operations);
                }
            });
            dispatch_release(dispatchGroup);
        }];
    
        NSPredicate *finishedOperationPredicate = [NSPredicate predicateWithFormat:@"isFinished == YES"];
    
        for (AFHTTPRequestOperation *operation in operations) {
            AFCompletionBlock originalCompletionBlock = [[operation.completionBlock copy] autorelease];
            operation.completionBlock = ^{
                dispatch_group_async(dispatchGroup, dispatch_get_main_queue(), ^{
                    if (originalCompletionBlock) {
                        originalCompletionBlock();
                    }
    
                    if (progressBlock) {
                        progressBlock([[operations filteredArrayUsingPredicate:finishedOperationPredicate] count], [operations count]);
                    }
    
                    dispatch_group_leave(dispatchGroup);
                });
            };
    
            dispatch_group_enter(dispatchGroup);
            [batchedOperation addDependency:operation];
    
            [self enqueueHTTPRequestOperation:operation];
        }
    
        [self.operationQueue addOperation:batchedOperation];
    }
    

    calls dispatch_group_leave(dispatchGroup) at the end of the completion block, but for AFJSONRequestOperation, it doesn't mean we are done with the completion block since we parse JSON in a separate dispatch queue and later fire back success or failure completion blocks to the main / success queue. So, there is still a chance, and I have seen it happening, that NSBlockOperation completion block gets processed first.

    Possible fix: we need to save dispatch group for each operation and call dispatch_group_leave after we are really done with success / failure completion blocks. Those blocks should be processed using dispatch_group_async instead of just dispatch_async if dispatch group is saved within operation.

    opened by nutritious 49
  • Apple Review

    Apple Review

    After uploading the App to appstoreconnect,we receive this message:

    ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs . See https://developer.apple.com/documentation/uikit/uiwebview for more information.
    

    I am integrating AFNetworking by CocoaPods,I wonder how can i delete the files that using UIWebView related API.

    opened by seanLee 47
  • Duplicate GET request are sent when switching to background

    Duplicate GET request are sent when switching to background

    What did you do?

    Create an oauth1 GET request using alamofire 9. Switched to iOS home screen. Returned to the app.

    *This is also happens very rarely even without moving to background

    What did you expect to happen?

    Requests are getting cancelled / errored when backgrounded and are sent to the retry interceptor to determine if they should be retried or not.

    What happened instead?

    In most cases it works as expected. but in some random cases, i get 401 unauthorized error from the server that the oauth nonce was already in use. Looking at the server log it seems that there are 2 identical requests that are fired from the app. without reaching to the request interceptor or to the Adapt method for new nonce. It looks like it's the underlaying urlsession that automatically retries GET requests (didn't see it happen for POST / PUT) when switching to background / connection to the server fails at the low level?

    I've tried multiple URLSessionConfiguration settings without success. I would like to know if there's a way to stop iOS from sending duplicate GET requests sometimes or if a 401 error can get to the retry interceptor. It goes directly to the failed completion block of the calling function.

    Thanks!

    AFNetworking Environment

    **AFNetworking version: 9.0.0 **Xcode version:14.2 **Swift version: 5 **Platform(s) running AFNetworking: iOS / iPad os **macOS version running Xcode: 13.1

    opened by patzootz 0
  • SSL pinning always fail when running on Apple Silicon machines.

    SSL pinning always fail when running on Apple Silicon machines.

    What did you do?

    Tried accessing a web resource protected using HTTPS with SSL pinning in an iOS app when setting the target to "My Mac (Designed for iPad).

    What did you expect to happen?

    Request should work

    What happened instead?

    Request fails - The following code in AFSecurityPolicy.m

    static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) {
    #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
        return [(__bridge id)key1 isEqual:(__bridge id)key2];
    #else
        return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)];
    #endif
    }
    

    always return false (it seems like the isEqual method is not working)

    changing boolean method to

     return [(__bridge_transfer NSData *)SecKeyCopyExternalRepresentation(key1, nil) isEqual:
             (__bridge_transfer NSData *)SecKeyCopyExternalRepresentation(key2, nil)];
    

    seems to solve the issue.

    AFNetworking Environment

    Xcode version: 14.2 Swift version: 5.7 Platform(s) running AFNetworking: ios app on Apple Silicon macOS version running Xcode: macOS 12.6.1

    opened by oryonatan 0
  • SecTrustEvaluate warning

    SecTrustEvaluate warning

    AFNetworking Environment

    **AFNetworking version:3.0 **Xcode version:14.1 **Swift version:5.7 **Platform(s) running AFNetworking:ios **macOS version running Xcode:12.6

    SecTrustEvaluate(serverTrust, &result) warn: This method should not be called on the main thread as it may lead to UI unresponsiveness.

    opened by WGFcode 0
  • When will a new version of AFNetworking be released?

    When will a new version of AFNetworking be released?

    I notice that AFNetworking was last released on April 20, 2020. I know that AFNetworking is a mature and stable software, but I still want to ask why AFNetworking has not released a new version recently and whether there is any future release plan.

    opened by lalogada 0
  • AFNetWorking 4.0.1 crash in AFURLRequestSerialization setTimeoutInterval:(NSTimeInterval)timeoutInterval

    AFNetWorking 4.0.1 crash in AFURLRequestSerialization setTimeoutInterval:(NSTimeInterval)timeoutInterval

    Recently, I encountered a very headache, because in some of my pages need several network interfaces to request the result before displaying the page, so I adopted the thread group solution to solve the multi-interface request return result. But occasionally I will collapse in AFURLRequestSerialization approach setTimeoutInterval timeoutInterval: (NSTimeInterval) method。 E65904BFD2C44A43E091C4062BBAC76A B1D1F88B43A86279B92FB58AD1EB535C B1D1F88B43A86279B92FB58AD1EB535C EAE1234EE3B1450FECE7365E1B67DB4B

    opened by taojeff 2
  • Xcode14 This method should not be called on the main thread as it may lead to UI unresponsiveness.

    Xcode14 This method should not be called on the main thread as it may lead to UI unresponsiveness.

    What did you do?

    ℹXcode14 warning.

    AFNetworking Environment

    AFNetworking version: Xcode 14: Swift version: iphone running AFNetworking: macOS version 12.6 running Xcode:

    3EB45B2F-5EE4-4AD2-9188-E138F97424A1

    opened by yunjinghui123 5
Releases(4.0.1)
  • 4.0.1(Apr 20, 2020)

    Released on Sunday, April 19, 2020. All issues associated with this milestone can be found using this filter.

    Updated

    • Project templates and integrations.
      • Implemented by Kaspik in #4531.
    • Various CocoaPods podspec settings.

    Fixed

    • Crash during authentication delegate method.
    • SPM integration.
      • Implemented by jshier in #4554.
    • Improper update instead of replacement of header values.
      • Implemented by ElfSundae in #4550.
    • Nullability of some methods.
      • Implemented by ElfSundae in #4551.
    • Typos in CHANGELOG.
      • Implemented by ElfSundae in #4537.
    • Missing tvOS compatibility for some methods.
      • Implemented by ElfSundae in #4536.
    • Missing FOUNDATION_EXPORT for AFJSONObjectByRemovingKeysWithNullValues.
      • Implemented by ElfSundae in #4529.

    Removed

    • Unused UIImage+AFNetworking.h file.
      • Implemented by ElfSundae in #4535.
    Source code(tar.gz)
    Source code(zip)
  • 4.0.0(Mar 29, 2020)

    Released on Sunday, March 29, 2020. All issues associated with this milestone can be found using this filter.

    Added

    • Notificate when a downloaded file has been moved successfully.
      • Implemented by xingheng in #4393.
    • Specific error for certificate pinning failure.
      • Implemented by 0xced in #3425.
    • WKWebView extensions.
      • Implemented by tjanela in #4439.
    • Automatic location of certificates in the main bundle for certificate pinning.
      • Implemented by 0xced in #3752.
    • User-Agent support for tvOS.
      • Implemented by ghking in #4014.
    • Ability for AFHTTPSessionManager to recreate its underlying NSURLSession.
      • Implemented by Kaspik in #4256.
    • Ability to set HTTP headers per request.
      • Implemented by stnslw in #4113.
    • Ability to capture NSURLSessionTaskMetrics.
      • Implemented by Caelink in #4237.

    Updated

    • dataTaskWithHTTPMethod to be public.
      • Implemented by smartinspereira in #4007.
    • Reachability notification to include the instance which issued the notification.
      • Implemented by LMsgSendNilSelf in #4051.
    • AFJSONObjectByRemovingKeysWithNullValues to be public.
      • Implemented by ashfurrow in #4051.
    • AFJSONObjectByRemovingKeysWithNullValues to remove NSNull values from NSArrays.
      • Implemented by ashfurrow in #4052.

    Changed

    • Automated CI to GitHub Actions.
      • Implemented by jshier in #4523.

    Fixed

    • Explicit NSSecureCoding support.
      • Implemented by jshier in #4523.
    • Deprecated API usage on Catalyst.
      • Implemented by jshier in #4523.
    • Nullability annotations.
      • Implemented by jshier in #4523.
    • AFImageDownloader to more accurately cancel downloads.
      • Implemented by kinarobin in #4407.
    • Double KVO notifications in AFNetworkActivityManager.
      • Implemented by kinarobin in #4406.
    • Availability annotations around NSURLSessionTaskMetrics.
      • Implemented by ElfSundae in #4516.
    • Issues with associated_object and subclasses.
      • Implemented by welcommand in #3872.
    • Memory leak in example application.
      • Implemented by svoit in #4196.
    • Crashes in mulithreaded scenarios and dispatch_barrier.
      • Implemetned by streeter in #4474.
    • Issues with NSSecureCoding.
      • Implemented by ElfSudae in #4409.
    • Code style issues.
      • Implemented by svoit in #4200.
    • Race condition in AFImageDownloader.
      • Implemented by bbeversdorf in #4246.
    • Coding style issues.
      • Implemented by LeeHongHwa in #4002.

    Removed

    • Support for iOS < 9, macOS < 10.10.
      • Implemented by jshier in #4523.
    • All previously deprecated APIs.
      • Implemented by jshier in #4523.
    • Unnecessary __block capture.
      • Implemented by kinarobin in #4526.
    • Workaround for NSURLSessionUploadTask creation on iOS 7.
      • Implemented by kinarobin in #4525.
    • Workaround for safe NSURLSessionTask creation on iOS < 8.
      • Implemented by kinarobin in #4401.
    • UIWebView extensions.
      • Implemented by tjanela in #4439.
    Source code(tar.gz)
    Source code(zip)
  • 2.7.0(Feb 13, 2019)

  • 3.2.1(May 4, 2018)

    Released on Friday, May 04, 2018. All issues associated with this milestone can be found using this filter.

    Updated

    • Xcode 9.3 Support
      • Implemented by Jeff Kelley in #4199.
    • Update HTTPBin certificates for April 2018.
      • Implemented by Jeff Kelley in #4198.

    Additional Changes

    • Remove conflicting nullable specifier on init
      • Implemented by Nick Brook and Jeff Kelley in #4182.
    • Use @available if available to silence a warning.
      • Implemented by Jeff Kelley in #4138.
    • UIImageView+AFNetworking: Prevent stuck state for malformed urlRequest
      • Implemented by Adam Duflo and aduflo in #4131.
    • add the link for LICENSE
      • Implemented by Liao Malin in #4125.
    • Fix analyzer warning for upload task creation
      • Implemented by Jeff Kelley in #4122.
    Source code(tar.gz)
    Source code(zip)
  • 3.2.0(Dec 15, 2017)

    Released on Friday, December 15, 2017. All issues associated with this milestone can be found using this filter.

    Added

    • Config AFImageDownloader NSURLCache and ask AFImageRequestCache implementer if an image should be cached
      • Implemented by wjehenddher in #4010.
    • Add XMLParser/XMLDocument serializer tests
      • Implemented by skyline75489 in #3753.
    • Enable custom httpbin URL with HTTPBIN_BASE_URL environment variable
      • Implemented by 0xced in #3748.
    • AFHTTPSessionManager now throws exception if SSL pinning mode is set for non https sessions
      • Implemented by 0xced in #3687.

    Updated

    • Update security policy test certificates
      • Implemented by SlaunchaMan in #4103.
    • Allow return value of HTTP redirection block to be NULL
      • Implemented by TheDom in #3975.
    • Clarify documentation for supported encodings in AFJSONResponseSerializer
      • Implemented by skyline75489 in #3750.
    • Handle Error Pointers according to Cocoa Convention
      • Implemented by tclementdev in #3653.
    • Updates AFHTTPSessionManager documentation to reflect v3.x change
      • Implemented by ecaselles in #3476.
    • Improved code base to generate fewer warnings when using stricter compiler settings
      • Implemented by 0xced in 3431.

    Changed

    • Change “Mac OS X” and “OS X” references to “macOS”
      • Implemented by SlaunchaMan in #4104.

    Fixed

    • Fixed crash around customizing NSURLCache size for < iOS 8.2
      • Implemented by kcharwood in #3735.
    • Fixed issue where UIWebView extension did not preserve all of the request information
      • Implemented by skyline75489 in #3733.
    • Fixed bug with webview delegate callback
      • Implemented by kcharwood in #3727.
    • Fixed crash when passing invalid JSON to request serialization
      • Implemented by 0xced in #3719.
    • Fixed potential KVO crasher for URL Session Task delegates
      • Implemented by 0xced in #3718.
    • Removed ambiguous array creation in AFSecurityPolicy
      • Implemented by sgl0v in #3679.
    • Fixed issue where NS_UNAVAILABLE is not reported for AFNetworkReachabilityManager
      • Implemented by Microbee23 in #3649.
    • Require app extension api only on watchOS
      • Implemented by ethansinjin in #3612.
    • Remove KVO of progress in favor of using the NSURLSession delegate APIs
      • Implemented by coreyfloyd in #3607.
    • Fixed an issue where registering a UIProgessView to a task that was causing a crash
      • Implemented by Starscream27 in #3604.
    • Moved [self didChangeValueForKey:@"currentState"] into correct scope
      • Implemented by chenxin0123 in #3565.
    • Fixed issue where response serializers did not inherit super class copying
      • Implemented by kcharwood in #3559.
    • Fixed crashes due to race conditions with NSMutableDictionary access in AFHTTPRequestSerializer
      • Implemented by alexbird in #3526.
    • Updated dash character to improve markdown parsing for license
      • Implemented by gemmakbarlow in #3488.

    Removed

    • Deprecate the unused stringEncoding property of AFHTTPResponseSerializer
      • Implemented by 0xced in #3751.
    • Removed unused AFTaskStateChangedContext
      • Implemented by yulingtianxia in #3432.
    Source code(tar.gz)
    Source code(zip)
  • 3.1.0(Mar 31, 2016)

    Released on Thursday, March 31, 2016. All issues associated with this milestone can be found using this filter.

    Added

    • Improved AFImageResponseSerializer test coverage
      • Implemented by quellish in #3367.
    • Exposed AFQueryStringFromParameters and AFPercentEscapedStringFromString for public use.
      • Implemented by Kevin Harwood in #3160.

    Updated

    • Updated Test Suite to run on Xcode 7.3
      • Implemented by Kevin Harwood in #3418.
    • Added white space to URLs in code comment to allow Xcode to properly parse them
      • Implemented by Draveness in #3384.
    • Updated documentation to match method names and correct compiler warnings
      • Implemented by Hakon Hanesand in #3369.
    • Use NSKeyValueChangeNewKey constant in change dictionary rather than hardcoded string.
      • Implemented by Wenbin Zhang in #3360.
    • Resolved compiler warnings for documentation errors
      • Implemented by Ricardo Santos in #3336.

    Changed

    • Reverted NSURLSessionAuthChallengeDisposition to NSURLSessionAuthChallengeCancelAuthenticationChallenge for SSL Pinning
      • Implemented by Kevin Harwood in #3417.

    Fixed

    • Removed trailing question mark in query string if parameters are empty
      • Implemented by Kevin Harwood in #3386.
    • Fixed crash if bad URL was passed into the image downloader
      • Implemented by Christian Wen and Kevin Harwood in #3385.
    • Fixed image memory calculation
      • Implemented by 周明宇 in #3344.
    • Fixed issue where UIButton image downloading called wrong cancel method
      • Implemented by duanhong in #3332.
    • Fixed image downloading cancellation race condition
      • Implemented by Kevin Harwood in #3325.
    • Fixed static analyzer warnings on AFNetworkReachabilityManager
      • Implemented by Jeff Kelley in #3315.
    • Fixed issue where download progress would not be reported in iOS 7
      • Implemented by zwm in #3294.
    • Fixed status code 204/205 handling
      • Implemented by Kevin Harwood in #3292.
    • Fixed crash when passing nil/null for progress in UIWebView extension
      • Implemented by Kevin Harwood in #3289.

    Removed

    • Removed workaround for NSJSONSerialization bug that was fixed in iOS 7
      • Implemented by Cédric Luthi in #3253.
    Source code(tar.gz)
    Source code(zip)
    AFNetworking.framework.zip(7.57 MB)
  • 3.0.4(Dec 18, 2015)

  • 3.0.3(Dec 16, 2015)

  • 3.0.2(Dec 14, 2015)

    Released on Monday, December 14, 2015. All issues associated with this milestone can be found using this filter.

    Fixed

    • Fixed a crash in AFURLSessionManager when resuming download tasks
      • Implemented by Chongyu Zhu in #3222.
    • Fixed issue where background button image would not be updated
      • Implemented by eofs in #3220.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.1(Dec 11, 2015)

    Released on Friday, December 11, 2015. All issues associated with this milestone can be found using this filter.

    Added

    • Added Xcode 7.2 support to Travis
      • Implemented by Kevin Harwood in #3216.

    Fixed

    • Fixed race condition with ImageView/Button image downloading when starting/cancelling/starting the same request
      • Implemented by Kevin Harwood in #3215.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0(Dec 10, 2015)

    Released on Thursday, December 10, 2015. All issues associated with this milestone can be found using this filter.

    Migration

    For detailed information about migrating to AFNetworking 3.0.0, please reference the migration guide.

    Changes

    Added

    • Added support for older versions of Xcode to Travis
      • Implemented by Kevin Harwood in #3209.
    • Added support for Codecov.io
      • Implemented by Cédric Luthi and Kevin Harwood in #3196.
    • Added support for IPv6 to Reachability
      • Implemented by SAMUKEI and Kevin Harwood in #3174.
    • Added support for Objective-C light weight generics
      • Implemented by Kevin Harwood in #3166.
    • Added nullability attributes to response object in success block
      • Implemented by Nathan Racklyeft in #3154.
    • Migrated to Fastlane for CI and Deployment
      • Implemented by Kevin Harwood in #3148.
    • Added support for tvOS
      • Implemented by Kevin Harwood in #3128.
    • New image downloading architecture
      • Implemented by Kevin Harwood in #3122.
    • Added Carthage Support
      • Implemented by Kevin Harwood in #3121.
    • Added a method to create a unique reachability manager
      • Implemented by Mo Bitar in #3111.
    • Added a initial delay to the network indicator per the Apple HIG
      • Implemented by Kevin Harwood in #3094.

    Updated

    • Improved testing reliability for continuous integration
      • Implemented by Kevin Harwood in #3124.
    • Example project now consumes AFNetworking as a library.
      • Implemented by Kevin Harwood in #3068.
    • Migrated to using instancetype where applicable
      • Implemented by Kyle Fuller in #3064.
    • Tweaks to project to support Framework Project
      • Implemented by Christian Noon in #3062.

    Changed

    • Split the iOS and OS X AppDelegate classes in the Example Project
      • Implemented by Cédric Luthi in #3193.
    • Changed SSL Pinning Error to be NSURLErrorServerCertificateUntrusted
      • Implemented by Cédric Luthi and Kevin Harwood in #3191.
    • New Progress Reporting API using NSProgress
      • Implemented by Kevin Harwood in #3187.
    • Changed pinnedCertificates type in AFSecurityPolicy from NSArray to NSSet
      • Implemented by Cédric Luthi in #3164.

    Fixed

    • Improved task creation performance for iOS 8+
      • Implemented by nikitahils, Nikita G and Kevin Harwood in #3208.
    • Fixed certificate validation for servers providing incomplete chains
      • Implemented by André Pacheco Neves in #3159.
    • Fixed bug in AFMultipartBodyStream that may cause the input stream to read more bytes than required.
      • Implemented by bang in #3153.
    • Fixed race condition crash from Resume/Suspend task notifications
      • Implemented by Kevin Harwood in #3152.
    • Fixed AFImageDownloader stalling after numerous failures
      • Implemented by Rick Silva in #3150.
    • Fixed warnings generated in UIWebView category
      • Implemented by Kevin Harwood in #3126.

    Removed

    • Removed AFBase64EncodedStringFromString static function
      • Implemented by Cédric Luthi in #3188.
    • Removed code supporting conditional compilation for unsupported development configurations.
      • Implemented by Cédric Luthi in #3177.
    • Removed deprecated methods, properties, and notifications from AFN 2.x
      • Implemented by Kevin Harwood in #3168.
    • Removed support for NSURLConnection
      • Implemented by Kevin Harwood in #3120.
    • Removed UIAlertView category support since it is now deprecated
      • Implemented by Kevin Harwood in #3034.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta.3(Dec 4, 2015)

    Build Statuscodecov.io

    For detailed information about migrating to AFNetworking 3.0.0, please reference the migration guide. All 3.0.0 beta changes will be tracked with this filter.

    Release Notes

    Beta 3 introduces API changes for tracking NSProgress. Feedback from the community is welcome as the 3.0.0 release will soon be finalized. Please provide feedback in #3187.

    The following changes have been made since 3.0.0-beta.2:

    Added

    • Added support for Codecov.io
      • Implemented by Cédric Luthi and Kevin Harwood in #3196.
      • Please help us increase overall coverage by submitting a pull request!
    • Added support for IPv6 to Reachability
      • Implemented by SAMUKEI and Kevin Harwood in #3174.
    • Added support for Objective-C light weight generics
      • Implemented by Kevin Harwood in #3166.
    • Added nullability attributes to response object in success block
      • Implemented by Nathan Racklyeft in #3154.

    Changed

    • Split the iOS and OS X AppDelegate classes in the Example Project
      • Implemented by Cédric Luthi in #3193.
    • Changed SSL Pinning Error to be NSURLErrorServerCertificateUntrusted
      • Implemented by Cédric Luthi and Kevin Harwood in #3191.
    • New Progress Reporting API using NSProgress
      • Implemented by Kevin Harwood in #3187.
    • Changed pinnedCertificates type in AFSecurityPolicy from NSArray to NSSet
      • Implemented by Cédric Luthi in #3164.

    Fixed

    • Fixed certificate validation for servers providing incomplete chains
      • Implemented by André Pacheco Neves in #3159.
    • Fixed bug in AFMultipartBodyStream that may cause the input stream to read more bytes than required.
      • Implemented by bang in #3153.

    Removed

    • Removed AFBase64EncodedStringFromString static function
      • Implemented by Cédric Luthi in #3188.
    • Removed code supporting conditional compilation for unsupported development configurations.
      • Implemented by Cédric Luthi in #3177.
    • Removed deprecated methods, properties, and notifications from AFN 2.x
      • Implemented by Kevin Harwood in #3168.
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta.2(Nov 13, 2015)

    Build Status

    For detailed information about migrating to AFNetworking 3.0.0, please reference the migration guide. All 3.0.0 beta changes will be tracked with this filter.

    In addition to all the relevant changes from 2.6.2 and 2.6.3, the following changes have been made since 3.0.0-beta.1:

    Added

    • Added nullability attributes to response object in success block
    • Migrated to Fastlane for CI and Deployment
    • Added a method to create a unique reachability manager
    • Added a initial delay to the network indicator per the Apple HIG

    Updated

    • Improved testing reliability for continuous integration

    Fixed

    • Fixed certificate validation for servers providing incomplete chains
    • Fixed bug in AFMultipartBodyStream that may cause the input stream to read more bytes than required.
    • Fixed race condition crash from Resume/Suspend task notifications
    • Fixed AFImageDownloader stalling after numerous failures
    • Fixed warnings generated in UIWebView category
    Source code(tar.gz)
    Source code(zip)
  • 2.6.3(Nov 11, 2015)

    Released on Wednesday, November 11, 2015. All issues associated with this milestone can be found using this filter.

    Fixed

    • Fixed clang analyzer warning suppression that prevented building under some project configurations
    • Restored Xcode 6 compatibility
    Source code(tar.gz)
    Source code(zip)
  • 2.6.2(Nov 6, 2015)

    Released on Friday, November 06, 2015. All issues associated with this milestone can be found using this filter.

    Important Upgrade Note for Swift

    • #3130 fixes a swift interop error that does have a breaking API change if you are using Swift. This was identified after 2.6.2 was released. It changes the method from throws to an error pointer, since that method does return an object and also handles an error pointer, which does not play nicely with the Swift/Objective-C error conversion. See #2810 for additional notes. This affects AFURLRequestionSerializer and AFURLResponseSerializer.

    Added

    Updated

    • Updated travis to run on 7.1
    • Simplifications of if and return statements in AFSecurityPolicy

    Fixed

    • Fixed swift interop issue that prevented returning a nil NSURL for a download task
    • Suppressed false positive memory leak warning in Reachability Manager
    • Fixed swift interop issue with throws and Request/Response serialization
    • Fixed race condition in reachability callback delivery
    • Fixed URLs that were redirecting in the README
    • Fixed Project Warnings
    • Fixed README link to WWDC session
    • Switched from OS_OBJECT_HAVE_OBJC_SUPPORT to OS_OBJECT_USE_OBJC for watchOS 2 support.
    • Added missing __nullable attributes to failure blocks in AFHTTPRequestOperationManager and AFHTTPSessionManager
    • Fixed memory leak in NSURLSession handling
    Source code(tar.gz)
    Source code(zip)
  • 3.0.0-beta.1(Oct 16, 2015)

    Build Status For detailed information about migrating to AFNetworking 3.0.0, please reference the migration guide. All future 3.0.0 beta changes will be tracked with this filter.

    New

    • AFNetworking relies exclusively on NSURLSession. All NSURLConnection support has been removed from AFNetworking.
    • AFNetworking now supports installation through Carthage.
    • All UIKit categories are now build on NSURLSession.
    • Image downloading has been rebuilt using the image downloading architecture from AlamofireImage.
    • AFNetworking now supports tvOS and Xcode 7.1
    • Example project has been refactored to include support for all supported platforms.
    • Test targets have been completely refactored
    • Many other minor improvements.

    The full changelog will be available for the final 3.0.0 release.

    Source code(tar.gz)
    Source code(zip)
  • 2.6.1(Oct 13, 2015)

    Future Compatibility Note Note that AFNetworking 3.0 will soon be released, and will drop support for all NSURLConnection based API's (AFHTTPRequestOperationManager, AFHTTPRequestOperation, and AFURLConnectionOperation. If you have not already migrated to NSURLSession based API's, please do so soon. For more information, please see the 3.0 migration guide.

    Fixed

    • Fixed a bug that prevented empty x-www-form-urlencoded bodies.
    • Fixed bug that prevented AFNetworking from being installed for watchOS via CocoaPods.
    • Added missing nullable attributes to AFURLRequestSerialization and AFURLSessionManager.
    • Migrated to OS_OBJECT_USE_OBJC.
    • Added missing nullable tags to UIKit extensions.
    • Fixed potential infinite recursion loop if multiple versions of AFNetworking are loaded in a target.
    • Updated Travis CI test script
    • Migrated to FOUNDATION_EXPORT from extern.
    • Fixed issue where AFURLConnectionOperation could get stuck in an infinite loop.
    • Fixed regression where URL request serialization would crash on iOS 8 for long URLs.
    Source code(tar.gz)
    Source code(zip)
  • 2.6.0(Aug 19, 2015)

    2.6.0 (08-18-2015) Released on Tuesday, August 18th, 2015. All issues associated with this milestone can be found using this filter.

    Important Upgrade Notes Please note the following API/project changes have been made:

    • iOS 6 support has now been removed from the podspec. Note that iOS 6 support has not been removed explicitly from the project, but it will be removed in a future update.
    • Full Certificate Chain Validation has been removed from AFSecurityPolicy. As discussed in #2744, there was no documented security advantage to pinning against an entire certificate chain. If you were using full certificate chain, please determine and select the most ideal certificate in your chain to pin against.
    • The request url will now be returned by the UIImageView category if the image is returned from cache. In previous releases, both the request and the response were nil. Going forward, only the response will be nil.
    • Support for App Extension Targets is now baked in using NS_EXTENSION_UNAVAILABLE_IOS. You no longer need to define AF_APP_EXTENSIONS in order to include code in a extension target.
    • This release now supports watchOS 2.0, which relys on target conditionals that are only present in Xcode 7 and iOS 9/watchOS 2.0/OS X 10.10. If you install the library using CocoaPods, AFNetworking will define these target conditionals for on older platforms, allowing your code to complile. If you do not use Cocoapods, you will need to add the following code your to PCH file.
    #ifndef TARGET_OS_IOS
      #define TARGET_OS_IOS TARGET_OS_IPHONE
    #endif
    #ifndef TARGET_OS_WATCH
      #define TARGET_OS_WATCH 0
    #endif
    
    • This release migrates query parameter serialization to model AlamoFire and adhere to RFC standards. Note that / and ? are no longer encoded by default.

    Note that support for NSURLConnection based API's will be removed in a future update. If you have not already done so, it is recommended that you transition to the NSURLSession APIs in the very near future.

    Added

    Fixed

    • Fixed a crash related for objects that observe notifications but don't properly unregister.
    • Fixed a race condition crash that occured with AFImageResponseSerialization.
    • Fixed an issue where tests failed to run on CI due to unavailable simulators.
    • Fixed "method override not found" warnings in Xcode 7 Betas
    • Removed Duplicate Import and UIKit Header file.
    • Removed the ability to include duplicate certificates in the pinned certificate chain.
    • Fixed potential memory leak in AFNetworkReachabilityManager.

    Documentation Improvements

    • Clarified best practices for Reachability per Apple recommendations.
    • Added startMonitoring call to the Reachability section of the README
    • Fixed documentation error around how baseURL is used for reachability monitoring.
    • Numerous spelling corrections in the documentation.
    Source code(tar.gz)
    Source code(zip)
  • 2.5.4(May 14, 2015)

    Released on 2015-05-14. All issues associated with this milestone can be found using this filter.

    Updated

    • Updated the CI test script to run iOS tests on all versions of iOS that are installed on the build machine.

    Fixed

    • Fixed an issue where AFNSURLSessionTaskDidResumeNotification and AFNSURLSessionTaskDidSuspendNotification were not being properly called due to implementation differences in NSURLSessionTask in iOS 7 and iOS 8, which also affects the AFNetworkActivityIndicatorManager.
    • Fixed an issue where the OS X test linker would throw a warning during tests.
    • Fixed an issue where tests would randomly fail due to mocked objects not being cleaned up.
    Source code(tar.gz)
    Source code(zip)
  • 2.5.3(Apr 20, 2015)

    • Add security policy tests for default policy
    • Add network reachability tests
    • Change validatesDomainName property to default to YES under all security policies
    • Fix NSURLSession subspec compatibility with iOS 6 / OS X 10.8
    • Fix leak of data task used in NSURLSession swizzling
    • Fix leak for observers from addObserver:...:withBlock:
    • Fix issue with network reachability observation on domain name
    Source code(tar.gz)
    Source code(zip)
  • 2.5.2(Mar 26, 2015)

    • Add guards for unsupported features in iOS 8 App Extensions
    • Add missing delegate callbacks to UIWebView category
    • Add test and implementation of strict default certificate validation
    • Add #define for NS_DESIGNATED_INITIALIZER for unsupported versions of Xcode
    • Fix AFNetworkActivityIndicatorManager for iOS 7
    • Fix AFURLRequestSerialization property observation
    • Fix testUploadTasksProgressBecomesPartOfCurrentProgress
    • Fix warnings from Xcode 6.3 Beta
    • Fix AFImageWithDataAtScale handling of animated images
    • Remove AFNetworkReachabilityAssociation enumeration
    • Update to conditional use assign semantics for GCD properties based on OS_OBJECT_HAVE_OBJC_SUPPORT for better Swift support
    Source code(tar.gz)
    Source code(zip)
  • 2.5.1(Mar 26, 2015)

    • Add NS_DESIGNATED_INITIALIZER macros. (Samir Guerdah)
    • Fix and clarify documentation for stringEncoding property. (Mattt Thompson)
    • Fix for NSProgress bug where two child NSProgress instances are added to a parent NSProgress. (Edward Povazan)
    • Fix incorrect file names in headers. (Steven Fisher)
    • Fix KVO issue when running testing target caused by lack of automaticallyNotifiesObserversForKey: implementation. (Mattt Thompson)
    • Fix use of variable arguments for UIAlertView category. (Kenta Tokumoto)
    • Fix genstrings warning for NSLocalizedString usage in UIAlertView+AFNetworking. (Adar Porat)
    • Fix NSURLSessionManager task observation for network activity indicator manager. (Phil Tang)
    • Fix UIButton category method caching of background image (Fernanda G. Geraissate)
    • Fix UIButton category method failure handling. (Maxim Zabelin)
    • Update multipart upload method requirements to ensure request.HTTPBody is non-nil. (Mattt Thompson)
    • Update to use builtin __Require macros from AssertMacros.h. (Cédric Luthi)
    • Update parameters parameter to accept id for custom serialization block. (@mooosu)
    Source code(tar.gz)
    Source code(zip)
  • 2.5.0(Nov 18, 2014)

    • Add documentation for expected background session manager usage (Aaron Brager)
    • Add missing documentation for AFJSONRequestSerializer and AFPropertyListSerializer (Mattt Thompson)
    • Add tests for requesting HTTPS endpoints (Mattt Thompson)
    • Add init method declarations of AFURLResponseSerialization classes for Swift compatibility (Allen Rohner)
    • Change default User-Agent to use the version number instead of the build number (Tim Watson)
    • Change validatesDomainName to readonly property (Mattt Thompson, Brian King)
    • Fix checks when observing AFHTTPRequestSerializerObservedKeyPaths (Jacek Suliga)
    • Fix crash caused by attempting to set nil NSURLResponse -URL as key for userInfo dictionary (Elvis Nuñez)
    • Fix crash for multipart streaming requests in XPC services (Mattt Thompson)
    • Fix minor aspects of response serializer documentation (Mattt Thompson)
    • Fix potential race condition for AFURLConnectionOperation -description
    • Fix widespread crash related to key-value observing of NSURLSessionTask -state (Phil Tang)
    • Fix UIButton category associated object keys (Kristian Bauer, Mattt Thompson)
    • Remove charset parameter from Content-Type HTTP header field values for AFJSONRequestSerializer and AFPropertyListSerializer (Mattt Thompson)
    • Update CocoaDocs color scheme (@Orta)
    • Update Podfile to explicitly define sources (Kyle Fuller)
    • Update to relay downloadFileURL to the delegate if the manager picks a fileURL (Brian King)
    • Update AFSSLPinningModeNone to not validate domain name (Brian King)
    • Update UIButton category to cache images in sharedImageCache (John Bushnell)
    • Update UIRefreshControl category to set control state to current state of request (Elvis Nuñez)
    Source code(tar.gz)
    Source code(zip)
  • 2.4.1(Sep 4, 2014)

    • Fix compiler warning generated on 32-bit architectures (John C. Daub)
    • Fix potential crash caused by failed validation with nil responseData (Mattt Thompson)
    • Fix to suppress compiler warnings for out-of-range enumerated type value assignment (Mattt Thompson)
    Source code(tar.gz)
    Source code(zip)
  • 2.4.0(Sep 3, 2014)

    • Add CocoaDocs color scheme (Orta)
    • Add image cache to UIButton category (Kristian Bauer, Mattt Thompson)
    • Add test for success block on 204 response (Mattt Thompson)
    • Add tests for encodable and re-encodable query string parameters (Mattt Thompson)
    • Add AFHTTPRequestSerializer -valueForHTTPHeaderField: (Kyle Fuller)
    • Add AFNetworkingOperationFailingURLResponseDataErrorKey key to user info of serialization error (Yannick Heinrich)
    • Add imageResponseSerializer property to UIButton category (Kristian Bauer, Mattt Thompson)
    • Add removesKeysWithNullValues setting to serialization and copying (Jon Shier)
    • Change request and response serialization tests to be factored out into separate files (Mattt Thompson)
    • Change signature of success parameters in UIButton category methods to match those in UIImageView (Mattt Thompson)
    • Change to remove charset parameter from application/x-www-form-urlencoded content type (Mattt Thompson)
    • Change AFImageCache to conform to NSObject protocol ( Marcelo Fabri)
    • Change AFMaximumNumberOfToRecreateBackgroundSessionUploadTask to AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask (Mattt Thompson)
    • Fix documentation error for NSSecureCoding (Robert Ryan)
    • Fix documentation for URLSessionDidFinishEventsForBackgroundURLSession delegate method (Mattt Thompson)
    • Fix expired ADN certificate in example project (Carson McDonald)
    • Fix for interoperability within Swift project (Stephan Krusche)
    • Fix for potential deadlock due to KVO subscriptions within a lock (Alexander Skvortsov)
    • Fix iOS 7 bug where session tasks can have duplicate identifiers if created from different threads (Mattt Thompson)
    • Fix iOS 8 bug by adding explicit synthesis for delegate of AFMultipartBodyStream (Mattt Thompson)
    • Fix issue caused by passing nil as body of multipart form part (Mattt Thompson)
    • Fix issue caused by passing nil as destination in download task method (Mattt Thompson)
    • Fix issue with AFHTTPRequestSerializer returning a request and silently handling an error from a queryStringSerialization block (Kyle Fuller, Mattt Thompson)
    • Fix potential issues by ensuring invalidateSessionCancelingTasks only executes on main thread (Mattt Thompson)
    • Fix potential memory leak caused by deferred opening of output stream (James Tomson)
    • Fix properties on session managers such that default values will not trump values set in the session configuration (Mattt Thompson)
    • Fix README to include explicit call to start reachability manager (Mattt Thompson)
    • Fix request serialization error handling in AFHTTPSessionManager convenience methods (Kyle Fuller, Lars Anderson, Mattt Thompson)
    • Fix stray localization macro (Devin McKaskle)
    • Fix to ensure connection operation -copyWithZone: calls super implementation (Chris Streeter)
    • Fix UIButton category to only cancel request for specified state (@xuzhe, Mattt Thompson)
    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Jun 13, 2014)

  • 2.3.0(Jun 11, 2014)

    • Add check for AF_APP_EXTENSIONS macro to conditionally compile background method that makes API call unavailable to App Extensions in iOS 8 / OS X 10.10
    • Add further explanation for network reachability in documentation (Steven Fisher)
    • Add notification for initial change from AFNetworkReachabilityStatusUnknown to any other state (Jason Pepas, Sebastian S.A., Mattt Thompson)
    • Add tests for AFNetworkActivityIndicatorManager (Dave Weston, Mattt Thompson)
    • Add tests for AFURLSessionManager task progress (Ullrich Schäfer)
    • Add attemptsToRecreateUploadTasksForBackgroundSessions property, which attempts Apple's recommendation of retrying a failed upload task if initial creation did not succeed (Mattt Thompson)
    • Add completionQueue and completionGroup properties to AFHTTPRequestOperationManager (Robert Ryan)
    • Change serialization tests to be split over two different files (Mattt Thompson)
    • Change to make NSURLSession subspec not depend on NSURLConnection subspec (Mattt Thompson)
    • Change to make Serialization subspec not depend on NSURLConnection subspec (Nolan Waite, Mattt Thompson)
    • Change completionHandler of application:handleEventsForBackgroundURLSession:completion: to be run on main thread (Padraig Kennedy)
    • Change UIImageView category to accept any object conforming to AFURLResponseSerialization, rather than just AFImageResponseSerializer (Romans Karpelcevs)
    • Fix calculation and behavior of NSProgress (Padraig Kennedy, Ullrich Schäfer)
    • Fix deprecation warning for backgroundSessionConfiguration: in iOS 8 / OS X 10.10 (Mattt Thompson)
    • Fix implementation of copyWithZone: in serializer subclasses (Chris Streeter)
    • Fix issue in Xcode 6 caused by implicit synthesis of overridden NSStream properties (Clay Bridges, Johan Attali)
    • Fix KVO handling for NSURLSessionTask on iOS 8 / OS X 10.10 (Mattt Thompson)
    • Fix KVO leak for NSURLSessionTask (@Zyphrax)
    • Fix potential crash caused by attempting to use non-existent error of failing requests due to URLs exceeding a certain length (Boris Bügling)
    • Fix to check existence of uploadProgress block inside a referencing dispatch_async to avoid potential race condition (Kyungkoo Kang)
    • Fix UIImageView category race conditions (Sunny)
    • Remove unnecessary default operation response serializer setters (Mattt Thompson)
    Source code(tar.gz)
    Source code(zip)
  • 2.2.4(May 13, 2014)

    • Add NSSecureCoding support to all AFNetworking classes (Kyle Fuller, Mattt Thompson)
    • Change behavior of request operation NSOutputStream property to only nil out if responseData is non-nil, meaning that no custom object was set (Mattt Thompson)
    • Fix data tasks to not attempt to track progress, and rare related crash (Padraig Kennedy)
    • Fix issue with -downloadTaskDidFinishDownloading: not being called (Andrej Mihajlov)
    • Fix KVO leak on invalidated session tasks (Mattt Thompson)
    • Fix missing import of `UIRefreshControl+AFNetworking" (@BB9z)
    • Fix potential compilation errors on Mac OS X, caused by import order of <AssertionMacros.h>, which signaled an incorrect deprecation warning (Mattt Thompson)
    • Fix race condition in UIImageView+AFNetworking when making several image requests in quick succession (Alexander Crettenand)
    • Update documentation for -downloadTaskWithRequest: to warn about blocks being disassociated on app termination and backgrounding (Robert Ryan)
    Source code(tar.gz)
    Source code(zip)
  • 2.2.3(Apr 18, 2014)

    • Change removesKeysWithNullValues property to recursively remove null values from dictionaries nested in arrays (@jldagon)
    • Change to not override Content-Type header field values set by HTTPRequestHeaders property (Aaron Brager, Mattt Thompson)
    • Fix AFErrorOrUnderlyingErrorHasCodeInDomain function declaration for AFXMLDocumentResponseSerializer (Mattt Thompson)
    • Fix error domain check in AFErrorOrUnderlyingErrorHasCodeInDomain (Mattt Thompson)
    • Fix UIImageView category to only nil out request operation properties belonging to completed request (Mattt Thompson)
    • Fix removesKeysWithNullValues to respect NSJSONReadingMutableContainers option (Mattt Thompson)
    Source code(tar.gz)
    Source code(zip)
  • 2.2.2(Apr 15, 2014)

    • Add unit test for checking content type (Diego Torres)
    • Add boundary property to AFHTTPBodyPart -copyWithZone:
    • Add removesKeysWithNullValues property to AFJSONResponsSerializer to automatically remove NSNull values in dictionaries serialized from JSON (Mattt Thompson)
    • Change to accept id parameter type in HTTP manager convenience methods (Mattt Thompson)
    • Change to deprecate setAuthorizationHeaderFieldWithToken:, in favor of users specifying an Authorization header field value themselves (Mattt Thompson)
    • Change to use long long type to prevent a difference in stream size caps on 32-bit and 64-bit architectures (Yung-Luen Lan, Cédric Luthi)
    • Fix calculation of Content-Length in taskDidSendBodyData (Christos Vasilakis)
    • Fix for comparison of image view request operations (Mattt Thompson)
    • Fix for SSL certificate validation to check status codes at runtime (Dave Anderson)
    • Fix to add missing call to delegate in URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:
    • Fix to call taskDidComplete if delegate is missing (Jeff Ward)
    • Fix to implement respondsToSelector: for NSURLSession delegate methods to conditionally respond to conditionally respond to optional selectors if and only if a custom block has been set (Mattt Thompson)
    • Fix to prevent illegal state values from being assigned for AFURLConnectionOperation (Kyle Fuller)
    • Fix to re-establish AFNetworkingURLSessionTaskDelegate objects after restoring from a background configuration (Jeff Ward)
    • Fix to reduce memory footprint by nil-ing out request operation outputStream after closing, as well as image view request operation after setting image (Teun van Run, Mattt Thompson)
    • Remove unnecessary call in class constructor (Bernhard Loibl)
    • Remove unnecessary check for respondsToSelector: for UIScreen scale in User-Agent string (Samuel Goodwin)
    • Update App.net certificate and API base URL (Cédric Luthi)
    • Update examples in README (@petard, @orta, Mattt Thompson)
    • Update Travis CI icon to use SVG format (Maximilian Tagher)
    Source code(tar.gz)
    Source code(zip)
Owner
AFNetworking
A delightful iOS and OS X networking framework
AFNetworking
Lightweight Networking and Parsing framework made for iOS, Mac, WatchOS and tvOS.

NetworkKit A lightweight iOS, Mac and Watch OS framework that makes networking and parsing super simple. Uses the open-sourced JSONHelper with functio

Alex Telek 30 Nov 19, 2022
A networking library for iOS, macOS, watchOS and tvOS

Thunder Request Thunder Request is a Framework used to simplify making http and https web requests. Installation Setting up your app to use ThunderBas

3 SIDED CUBE 16 Nov 19, 2022
QwikHttp is a robust, yet lightweight and simple to use HTTP networking library for iOS, tvOS and watchOS

QwikHttp is a robust, yet lightweight and simple to use HTTP networking library. It allows you to customize every aspect of your http requests within a single line of code, using a Builder style syntax to keep your code super clean.

Logan Sease 2 Mar 20, 2022
Bonjour networking for discovery and connection between iOS, macOS and tvOS devices.

Merhaba Bonjour networking for discovery and connection between iOS, macOS and tvOS devices. Features Creating Service Start & Stop Service Stop Brows

Abdullah Selek 67 Dec 5, 2022
ZeroMQ Swift Bindings for iOS, macOS, tvOS and watchOS

SwiftyZeroMQ - ZeroMQ Swift Bindings for iOS, macOS, tvOS and watchOS This library provides easy-to-use iOS, macOS, tvOS and watchOS Swift bindings fo

Ahmad M. Zawawi 60 Sep 15, 2022
SwiftSoup: Pure Swift HTML Parser, with best of DOM, CSS, and jquery (Supports Linux, iOS, Mac, tvOS, watchOS)

SwiftSoup is a pure Swift library, cross-platform (macOS, iOS, tvOS, watchOS and Linux!), for working with real-world HTML. It provides a very conveni

Nabil Chatbi 3.7k Dec 28, 2022
A peer to peer framework for OS X, iOS and watchOS 2 that presents a similar interface to the MultipeerConnectivity framework

This repository is a peer to peer framework for OS X, iOS and watchOS 2 that presents a similar interface to the MultipeerConnectivity framework (which is iOS only) that lets you connect any 2 devices from any platform. This framework works with peer to peer networks like bluetooth and ad hoc wifi networks when available it also falls back onto using a wifi router when necessary. It is built on top of CFNetwork and NSNetService. It uses the newest Swift 2's features like error handling and protocol extensions.

Manav Gabhawala 93 Aug 2, 2022
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework

Serverside non-blocking IO in Swift Ask questions in our Slack channel! Lightning (formerly Edge) Node Lightning is an HTTP Server and TCP Client/Serv

SkyLab 316 Oct 6, 2022
Lightweight Concurrent Networking Framework

Dots Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ / macOS 10.10+ /

Amr Salman 37 Nov 19, 2022
Asynchronous socket networking library for Mac and iOS

CocoaAsyncSocket CocoaAsyncSocket provides easy-to-use and powerful asynchronous socket libraries for macOS, iOS, and tvOS. The classes are described

Robbie Hanson 12.3k Jan 8, 2023
Showcasing simple SwiftUI and networking capabilities

CovidCounts CovidCounts is powered by SwiftUI. It allows a user to view COVID related data for different U.S. States. App Purpose This app is showcasi

Joel Sereno 1 Oct 15, 2021
Swish is a networking library that is particularly meant for requesting and decoding JSON via Decodable

Swish Nothing but net(working). Swish is a networking library that is particularly meant for requesting and decoding JSON via Decodable. It is protoco

thoughtbot, inc. 369 Nov 14, 2022
Declarative and Reactive Networking for Swift.

Squid Squid is a declarative and reactive networking library for Swift. Developed for Swift 5, it aims to make use of the latest language features. Th

Oliver Borchert 69 Dec 18, 2022
foursquare iOS networking library

FSNetworking foursquare's iOS networking library FSN is a small library for HTTP networking on iOS. It comprises a single class, FSNConnection, and se

Foursquare 386 Sep 1, 2022
Extensible HTTP Networking for iOS

Bridge Simple Typed JSON HTTP Networking in Swift 4.0 GET GET<Dict>("http://httpbin.org/ip").execute(success: { (response) in let ip: Dict = respo

null 90 Nov 19, 2022
An elegant yet powerful iOS networking layer inspired by ActiveRecord.

Written in Swift 5 AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networki

Tunespeak 19 Nov 19, 2022
Elegant HTTP Networking in Swift

Alamofire is an HTTP networking library written in Swift. Features Component Libraries Requirements Migration Guides Communication Installation Usage

Alamofire 38.7k Jan 8, 2023
Type-safe networking abstraction layer that associates request type with response type.

APIKit APIKit is a type-safe networking abstraction layer that associates request type with response type. // SearchRepositoriesRequest conforms to Re

Yosuke Ishikawa 1.9k Dec 30, 2022
Robust Swift networking for web APIs

Conduit Conduit is a session-based Swift HTTP networking and auth library. Within each session, requests are sent through a serial pipeline before bei

Mindbody 52 Oct 26, 2022