TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Parsing JSON in iOS the right way

4 点作者 adam0101超过 14 年前

2 条评论

BarkMore超过 14 年前
The author is using a library that parses an entire JSON document in one go. In order to use this library, the author points out that the application must collect the entire document from the network before parsing the document. It does not work if the application passes chunks of the document to the parser.<p>An alternative approach is to use an incremental parser like YAJL. The application can feed chunks of the JSON document to the parser as the chunks arrive over the network. A clever application can update the UI before the entire document is received by examining the partially constructed object tree.
评论 #2028876 未加载
imcqueen超过 14 年前
Good post. I think the same holds true for the NSXMLParser delegate (and probably many others, I'm still new to iOS).<p>The "foundCharacters" method is sometimes called multiple times before reaching the end of an element so it's best to assume you're receiving only part of the data.