Search code examples
objective-ccocoa-touchnsmutabledictionaryafnetworkingjsonkit

How do you get mutable dictionaries from AFNetworking and AFJSONRequestOperation?


I'm using JSONKit with AFNetworking's AFHTTPClient (with AFJSONRequestOperation) and I can't seem to figure out how one might trigger the use of the mutableObjectFrom... methods of JSONKit rather than the normal parser methods which return (or arrays of) JKDictionary.

Is this possible without modifying AFNetworking?


Solution

  • You can't do that without editing AFNetworking code.

    In AFJSONUtilities.m change (line 103)

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

    By

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