Questions tagged [afjsonrequestoperation]

AFJSONRequestOperation is a class for downloading and working with JSON response data. It's part of AFNetworking .

AFJSONRequestOperation is a subclass of AFHTTPRequestOperation for downloading and working with JSON response data. It uses an instance of AFJSONSerialization to handle response validation and serialization.

It's part of AFNetworking :

A delightful iOS and OS X networking framework

Github: https://github.com/AFNetworking/AFContentRequestOperations/blob/master/AFJSONRequestOperation/AFJSONRequestOperation.h

27 questions
32
votes
3 answers

How to get the response data out of the NSHTTPURLResponse in the callback of AFJSONRequestOperation?

I have a situation where I need to access the raw response data for an AFJSONRequestOperation, from within the callback block which includes only NSHTTPURLResponse. I am able to get the statusCode from the NSHTTPURLResponse, but don't see any way to…
22
votes
2 answers

Replacement for AFJSONRequestOperation in AFNetworking 2.x

I am making a basic iPhone app with HTML Requests, by following this tutorial. The tutorial has me using AFJSONRequestOperation in AFNetworking. The trouble is, I'm using AFNetworking version 2, which no longer has AFJSONRequestOperation. So, of…
5
votes
1 answer

Timeout for AFNetworking

I'm using AFJSONRequestOperation to upload the images. In the case of uploading numbers of images, some requests are failed with the timeout error. I tried AFJSONRequestOperation *operation = ... [operation start]; and AFJSONRequestOperation…
Yun
  • 5,233
  • 4
  • 21
  • 38
4
votes
5 answers

AFNetworking version 2 content-type error

I'm attempting to make an iphone app that will interact with a particular JIRA server. I've got the following code to log in: NSURL *url = [[NSURL alloc]…
3
votes
2 answers

AFNetworking : Handling of asynchronous get request with AFJSONRequestOperation

I have the following code inside a class (static method) which I call to get data from an API. I decided to make this a static method just so I can reuse it on some other parts of the app. + (NSArray*) getAllRoomsWithEventId:(NSNumber *)eventId{ …
gdubs
  • 2,724
  • 9
  • 55
  • 102
1
vote
2 answers

How do I add an NSArray of NSDictionaries to a AFJSONRequestSerializer request?

I wrote some code to put a NS(Mutable)Dictionary in a NSArray. But after adding the dictionary to the array, it seems it creates separate dictionaries for each key-value pair. See example below. NSMutableDictionary *info = [[NSMutableDictionary…
Angelo A
  • 2,744
  • 6
  • 28
  • 37
1
vote
2 answers

How to encode json response and write it in array?

I am using AFJSONRequestOperation to obtain the list of my friends. Here’s the request: /// get friends NSString *str = [NSString stringWithFormat:@"https://api.vk.com/method/friends.get?fields=first_name,last_name&uid=%@&access_token=%@",…
Blaze
  • 73
  • 6
1
vote
2 answers

In AFNetworking's JSONRequestOperationWithRequest:success:failure: method, what type of object is the JSON response?

It gives you a variable called JSON of type id, but how do I manipulate this? Is it a string? Do I have to serialize it first? How exactly do I interact with it?
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
1
vote
2 answers

POST a NSArray of NSDictionaries to php

I am trying to send an NSArray of NSDictionaries from my ios app to my php webservice and having problems receiving a certain string field. I form the POST parameters this way: NSDictionary *orderInformation = [NSDictionary…
Mike G
  • 751
  • 3
  • 12
  • 21
1
vote
0 answers

parameters encoding changed in AFJSONRequestOperation for Bing Search API query

I am trying to an image search with the Bing Search API but it doesn't work well with unicode characters NSDictionary *bingParams = [NSDictionary dictionaryWithObjectsAndKeys: @"'image'", @"Sources", …
minovsky
  • 857
  • 1
  • 15
  • 28
1
vote
1 answer

How can I use multiple AFJSONRequestOperations and combine the results into a single NSDictionary?

I'm not sure if I have two problems here or just one. I'm trying to download multiple JSON files from the Google Calendar API and combine all the results into a single NSDictionary or NSMutableDictionary. client = [[AFHTTPClient alloc]…
1
vote
1 answer

AFNetworking - batched operations completion block firing before all JSON requests completed

I'm just starting using AFNetworking and have come across an anomaly when using enqueueBatchOfHTTPRequestOperations to batch together 3 AFJSONRequestOperation objects. I've found that occasionally the completionBlock for the queue fires before all…
Jonathan Wareham
  • 3,357
  • 7
  • 46
  • 82
0
votes
0 answers

AFJSONRequestOperation : crash stacktrace

I am trying to fix one crash in my app, but I have to be honest I was not able to figure this one out so far. 0 libobjc.A.dylib 0x378f90fc objc_retain + 12 1 myApp 0x00254ce3 __74+[AFJSONRequestOperation…
0
votes
1 answer

posting JSON object to a Restful web service

I have two Restful web services: service1: api.wego.com/flights/api/k/2/searches and service2: api.wego.com/flights/api/k/2/fares service1's question: I want to use AFJSONRequestOperation to do a POST request to serivce1 , the using of…
JAHelia
  • 6,934
  • 17
  • 74
  • 134
0
votes
2 answers

AFJSONRequestOperation hitting failed block on 200 response.statusCode

My AFJSONRequestOperation is hitting the failure block on a 200 response. Is this because I have additional JSON? [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { NSDictionary *d = (NSDictionary…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
1
2