I'm seeing a crash in RKNSJSONSerialization on iOS 6 only - not on iOS 7. I'm using RestKit 0.20.3 and it happens fairly consistently for me. Even when I make the same request and get the same response for iOS 6/7, it works fine on iOS 7 but crashes on iOS 6.
Here's the crash - it's an EXC_BAD_ACCESS: http://crashes.to/s/2610b639062
The relevant (crashing) line in RestKit's RKNSJSONSerialization is the return:
+ (id)objectFromData:(NSData *)data error:(NSError **)error
{
return [NSJSONSerialization JSONObjectWithData:data options:0 error:error];
}
So perhaps it's not RestKit at all - perhaps it's NSJSONSerialization.
I profiled the app with the Zombies tool and found this:
"An Objective-C message was sent to a deallocated 'CFString (immutable)' object (zombie) at address: 0x16851250."
Am I doing something wrong?
I've resolved this. The issue was that my JSON had duplicate keys in it, and iOS 6 couldn't handle that. The solution is to remove the duplicate keys from the JSON before trying to parse it with NSJSONSerialization on iOS 6. Apparently Apple has resolved this issue on iOS 7, since it doesn't crash there.
Related: NSJSONSerialization bug?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With