Reputation: 5208
i am getting large amount of data from web service. If the amount of records it return is more than 1500 or 2000 the memory overflows and the app crashes. I don't need to save the data locally, just have to present the data to the user. How can i manage it not to crash and display whole of the data?
Upvotes: 2
Views: 1120
Reputation: 70997
The best way to go ahead with this would be to change the web service to accept a page param and return paginated results. To make it look seamless in a tableview, you can add infinite scrolling - i.e. if the user reaches row <last-10>
, send request for the next set of records and load them in the table view.
But even with this, I am assuming you will eventually face memory issues if you persist all your 2K records (your data array) in memory. So some memory management will be needed there as well.
Upvotes: 3
Reputation: 17535
You can use paging in table view and also use paging for your webservice.. You can show limited data at a time and if you scroll it then show next data. Table view help you to reuse your cell and show your 2000 records
For example
http://www.oodlestechnologies.com/blogs/Pagination-in-UITableview
Upvotes: 3