本文介绍了JSON解析方法不适用于iPhone中的ios4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我使用以下代码从JSON响应中获取响应.它在ios5中可以很好地工作,但对于ios4则不起作用.那么ios4的解决方案是什么.

I used following code to get response from JSON response. It working very nicely in ios5 but for ios4 it is not working. So what will be solution in ios4.

NSData *responseData = [NSURLConnection sendSynchronousRequest:requestForServer returningResponse:&response error:&err];
NSDictionary *res = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableLeaves error:&err];

    for(id key in res)
    {
        id value = [res objectForKey:key];

        NSString *keyAsString = (NSString *)key;
        valueAsString = (NSString *)value;

        NSLog(@"key: %@", keyAsString);
        NSLog(@"value: %@", valueAsString);
    }

如果有人知道这一点,请帮助我.

Please help me if anyone knows ans of this.

推荐答案

NSJSONSerialization,因为它仅在iOS 5.0+和Mac OS X 10.7+上受支持.我认为您也可以尝试使用第三方 JSON库

NSJSONSerialization since it is only supported on iOS 5.0+ and Mac OS X 10.7+. I think you can also have a try with third-party JSON Library

>>>已编辑

适用于iOS4和iOS5的Jsonkit

希望,这会对您有所帮助.

Hope, this will help you..

这篇关于JSON解析方法不适用于iPhone中的ios4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:27