views:

138

answers:

1

I'm writing an iPhone app that requests data from a web service, and in order to get that data, I'm using NSMutableURLRequest.

The problem that I am having is that the amount of data being requested is quite large (~11Mb), and this is causing my app to be killed by the OS.

Is there any way of streaming the data in a way that will allow me to process chunks of it, or should I just split the request over several separate requests in order to prevent the memory load spiking?

+3  A: 

Think about converting your use of NSMutableURLRequest to an NSURLConnection. That class provides a way to specify a delegate object that will receive a series of connection:didReceiveData: messages, each of which will have some chunk of data from your web server. You can implement this method in your delegate in such a way that it will process data as it becomes available while still waiting for more data from the connection.

Tim