iPhone Objective-C JSON解析器 [英] iPhone Objective-C JSON Parser

查看:141
本文介绍了iPhone Objective-C JSON解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人使用iPhone可用的JSON解析器对返回的JSON对象的大小限制有问题吗?

Has anyone had issues with a size limit on a returned JSON Object using the JSON Parser that is available for the iPhone?

我正在使用此开源JSON框架(正在使用最新版本)

I am using this open-source JSON Framework (I am using the latest version)

如果我减小返回的JSON的大小,我的应用程序将运行良好.如果对象太大,则应用程序崩溃并显示以下错误:

If I reduce the size of the returned JSON my app will run just fine. If the object gets too large, the app crashes with the below error:

-JSONValue failed. Error trace is: (
Error Domain=org.brautaset.JSON.ErrorDomain Code=3 UserInfo=0x4141580 "Unrecognised leading character"

但是不要上当...它与引导字符无关,只是它似乎将JSON拆分为一定大小,然后以随机的引导字符结尾,因为下一个JSON字符串以随机开头字符.

Don't be fooled though... it has nothing to do a leading character except that it seems to split the JSON at a certain size and then ends up with a random leading character because the next JSON string starts with a random character.

推荐答案

好像我错了.我试图在didReceiveData回调方法中解析JSON,该方法在接收到数据时被多次调用.我需要将结果连接起来,然后在connectionDidFinishLoading中解析JSON.

Looks like I was wrong. I was trying to parse the JSON in a didReceiveData callback method, which gets called multiple times as data is received. I needed to concatenate the result as it came in and then parse the JSON in connectionDidFinishLoading.

感谢您的光临.

这篇关于iPhone Objective-C JSON解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆