简体   繁体   English

如何在 IOS 中解析小块 JSON 数据?

[英]How to parse little chunks of JSON data in IOS?

I have a large JSON file.我有一个很大的 JSON 文件。

If I use NSJSONSerialization or SwiftyJSON to parse this file, the app gives memory warnings then it gets crashed.如果我使用 NSJSONSerialization 或 SwiftyJSON 来解析这个文件,应用程序会给出内存警告,然后它就会崩溃。

Best solution I can think of is, to parse the file as little (NSData) chunks.我能想到的最佳解决方案是将文件解析为小 (NSData) 块。

Does anyone know how to do that ?有谁知道怎么做?

SBJson4Parser做我想要的。

How big are your JSON files?你的 JSON 文件有多大? Do you have evidence that it is the JSON parser causing the problem?您是否有证据表明是 JSON 解析器导致了问题? If the file is large, how many copies of the data to you have?如果文件很大,您有多少份数据副本? I have no problems parsing a 20 MB JSON file on an iPhone 4, so what are you doing?我在 iPhone 4 上解析 20 MB JSON 文件没有问题,所以你在做什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM