How do I do partial download of JSON Data using NSConnection ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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
didReceiveDatamethod that you can implement for theNSUrlConnection‘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.