Frage

How do I do partial download of JSON Data using NSConnection ?

War es hilfreich?

Lösung

Can you provide a little bit more information about what you're trying to accomplish? I assume that you mean you would like to start processing the json before it is completely finished downloading. One thing you could look at the didReceiveData method that you can implement for the NSUrlConnection's delegate:

https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html

You could parse through the data as it comes down, and when you have enough JSON to parse you could begin processing it well before it is completely downloaded. Of course, that means you will probably have to parse the json string yourself rather than use one of the json parsers that expects a fully formed json string.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top