JKDictionary类对于JSONKit是私有的,不应以这种方式使用

这是一个后续问题,简而言之,我使我的应用程序与ios 4.3兼容,并使用在我的应用程序中支持ios 4的AFNetworking类版本0.10.1。 这行self.responseJSON = AFJSONDecode(self.responseData, &error); 给我错误的下面。 我不是很熟悉杰森,并试图找出这个错误的含义。

 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** - [JKDictionary allocWithZone:]: The JKDictionary class is private to JSONKit and should not be used in this fashion.' *** Call stack at first throw: ( 0 CoreFoundation 0x006ef5a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x018e6313 objc_exception_throw + 44 2 CoreFoundation 0x006a7ef8 +[NSException raise:format:arguments:] + 136 3 CoreFoundation 0x006a7e6a +[NSException raise:format:] + 58 ... ... 26 libdispatch_sim.dylib 0x02888289 _dispatch_call_block_and_release + 16 27 libdispatch_sim.dylib 0x0288acb4 _dispatch_queue_drain + 250 28 libdispatch_sim.dylib 0x0288b2c2 _dispatch_queue_invoke + 49 29 libdispatch_sim.dylib 0x0288b593 _dispatch_worker_thread2 + 261 30 libsystem_c.dylib 0x90093b24 _pthread_wqthread + 346 31 libsystem_c.dylib 0x900956fe start_wqthread + 30 

错误来自JSONKit.m:

 + (id)allocWithZone:(NSZone *)zone { #pragma unused(zone) [NSException raise:NSInvalidArgumentException format:@"*** - [%@ %@]: The %@ class is private to JSONKit and should not be used in this fashion.", NSStringFromClass([self class]), NSStringFromSelector(_cmd), NSStringFromClass([self class])]; return(NULL); } 

与iOS 5的应用程序正在使用self.responseJSON =[NSJSONSerialization JSONObjectWithData:self.responseData options:0 error:&error]; 这很好,但当然我不能在iOS 4中使用这个,因为NSJSONSerialization不支持。

任何forms的帮助,将不胜感激。

我结束了用这个self.responseJSON = [[CJSONDeserializer deserializer] deserialize:self.responseData error:&error];replace有问题的行self.responseJSON = [[CJSONDeserializer deserializer] deserialize:self.responseData error:&error];

使用不同的类( TouchJSON )只是为了这一行,但它现在很好用。