From f28cf63a9621d74c1644f7c3f0a844920a151583 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Mon, 21 Nov 2011 09:48:42 -0600 Subject: [PATCH] [Issue #116] Fixing SBJSon decoding function --- AFNetworking/AFJSONUtilities.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/AFNetworking/AFJSONUtilities.h b/AFNetworking/AFJSONUtilities.h index edfa4fe..bde5b75 100644 --- a/AFNetworking/AFJSONUtilities.h +++ b/AFNetworking/AFJSONUtilities.h @@ -110,8 +110,10 @@ static id AFJSONDecode(NSData *data, NSError **error) { [invocation invoke]; [invocation getReturnValue:&JSON]; } else if (_SBJSONSelector && [data respondsToSelector:_SBJSONSelector]) { + // Create a string representation of JSON, to use SBJSON -`JSONValue` category method + NSString *string = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[data methodSignatureForSelector:_SBJSONSelector]]; - invocation.target = data; + invocation.target = string; invocation.selector = _SBJSONSelector; [invocation invoke];