How do you get mutable dictionaries from AFNetworking and AFJSONRequestOperation?

I am using JSONKit with AFNetworking AFHTTPClient (with AFJSONRequestOperation), and I cannot figure out how to use mutableObjectFrom ... JSONKit methods, and not the usual parser methods that return (or arrays of) JKDictionary.

Is this possible without changing AFNetworking?

+2
source share
3 answers

You cannot do this without editing the AFNetworking code.

In change AFJSONUtilities.m (line 103)

SEL _JSONKitSelector = NSSelectorFromString(@"objectFromJSONDataWithParseOptions:error:"); 

By

SEL _JSONKitSelector = NSSelectorFromString(@"mutableObjectFromJSONDataWithParseOptions:error:"); 
+2
source

AFNetworking . , AFJSONRequestOperation * [ ],

[operation setJSONReadingOptions:NSJSONReadingMutableContainers];

JSON NSMutableDictionaries

+15

For NSJSONSerialization based on the AFNetworking operation in the AFJSONUtilities.m 203 line, change:

NSUInteger readOptions = 0

to

NSUInteger readOptions =  NSJSONReadingMutableContainers 
-1
source

All Articles