Questions tagged [afnetworking-2]

AFNetworking 2.0 is a networking library for iOS 6+ and Mac OS X 10.8+.

Home page

https://github.com/AFNetworking/AFNetworking

What's New

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

incomplete UML-ish class diagram

Related

1255 questions
247
votes
16 answers

'Project Name' was compiled with optimization - stepping may behave oddly; variables may not be available

Trying to step into AFNetworking code generates following warning: [Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available. And of course I'm not able to debug the code. To be specific I'm trying to…
Mojtaba
  • 6,012
  • 4
  • 26
  • 40
208
votes
14 answers

Request failed: unacceptable content-type: text/html using AFNetworking 2.0

I'm trying out the new version 2.0 of AFNetworking and I'm getting the error above. Any idea why this is happening? Here's my code: NSURL *URL = [NSURL URLWithString:kJSONlink]; NSURLRequest *request = [NSURLRequest requestWithURL:URL]; …
jaytrixz
  • 4,059
  • 7
  • 38
  • 57
82
votes
15 answers

AFNetworking Post Request

I'm a newbie in obj-c and have been using asihttp for some of my projects. When doing a post request in asihttp its done this way. ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:height…
Sam Barnet
  • 911
  • 2
  • 8
  • 6
79
votes
7 answers

AFNetworking 2.0 add headers to GET request

I've just started using AFNetworking 2.0 and I was wondering how I put in headers into a HTTP Get request. The documentation sets up a GET like this: AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; NSDictionary…
Mackey18
  • 2,322
  • 2
  • 25
  • 39
77
votes
10 answers

How can I log each request/response using Alamofire?

Is there a way to log each request / response using Alamofire (something similar to AFNetworkActivityLogger) ? I am aware of Printable, DebugPrintable and Output (cURL) but they are not quite what I am looking for.
Cosmin
  • 2,840
  • 5
  • 32
  • 50
54
votes
3 answers

AFNetworking and background transfers

I'm a bit confuse of how to take advantage of the new iOS 7 NSURLSession background transfers features and AFNetworking (versions 2 and 3). I saw the WWDC 705 - What’s New in Foundation Networking session, and they demonstrated background download…
Mario
  • 2,431
  • 6
  • 27
  • 34
52
votes
7 answers

AFNetworking 2.0 AFHTTPSessionManager: how to get status code and response JSON in failure block?

When switched to AFNetworking 2.0 the AFHTTPClient has been replaced by AFHTTPRequestOperationManager / AFHTTPSessionManager (as mentioned in the migration guide). The very first issue I came across when using the AFHTTPSessionManager is how to…
Oleksandr
  • 1,001
  • 1
  • 11
  • 14
51
votes
3 answers

How to download image with AFNetworking 2.0?

Appareantly there is no AFImageRequestOperation, but only AFImageResponseSerializer and frankly I don't get it or maybe I'm just looking too long through AFNetworking site... Downloading images with previous AFNetworking was like a charm. I'd hate…
raistlin
  • 4,298
  • 5
  • 32
  • 46
49
votes
5 answers

How to batch request with AFNetworking 2?

So I'm rewriting an app for iOS 7 with AFNetworking 2.0 and I'm running into the issue of sending a batch of requests at once and tracking their progress. In the old AFNetworking there was the…
Mac_Cain13
  • 3,611
  • 2
  • 24
  • 38
45
votes
3 answers

AFNetworking 2.0 and HTTP Basic Authentication

Can't find AFHTTPClient on AFNetworking 2.0, to use: AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://examplewebsite.com]]; [client setAuthorizationHeaderWithUsername:@"username" password:@"password"]; How it…
Marckaraujo
  • 7,422
  • 11
  • 59
  • 97
44
votes
5 answers

Posting JSON data using AFNetworking 2.0

I have a web script which accepts JSON string as input through HTTP POST request. I have came across several AFNetworking 1.x example for the same , can anybody please point me or give AFNetworking 2.0 example to do an HTTP POST request to a web…
vishal dharankar
  • 7,536
  • 7
  • 57
  • 93
37
votes
2 answers

AFNetworking 2: How to cancel a AFHTTPRequestOperationManager request?

I migrated my networking functionality from AFNetworking to AFNetworking v2 and instead of AFHttpClient I am using AFHTTPRequestOperationManager to support iOS6 as well. My issue is that while in AFHttpClient there was the functionality to cancel a…
ozzotto
  • 1,146
  • 3
  • 13
  • 30
34
votes
9 answers

Problems with SSL Pinning and AFNetworking 2.5.0 (NSURLErrorDomain error -1012.)

We’ve been having a hard time securing our app’s network connections with SSL using AFNetworking 2.5.0. We use a self-signed certificate authority and implemented a custom security policy using pinned certificates. We’ve tested quite a few…
davhab
  • 805
  • 2
  • 9
  • 17
33
votes
3 answers

Uploading image with AFNetworking 2.0

I'm banging my head against the wall with this one. I want to select UIImage from library and upload it to server, like on could do with
. Instead of success I got…
raistlin
  • 4,298
  • 5
  • 32
  • 46
29
votes
3 answers

(Cocoa error 3840.)" (Invalid value around character 0.) AFNetworking

I've been getting the following error when using the GET method to retrieve a file from a server: Error: Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (Invalid value around character 0.)…
Jonathan
  • 614
  • 1
  • 9
  • 18
1
2 3
83 84