So I am developing an iOS app that basically does the following:
On iPhone it is a UITabBarController
with five tabs, on the iPad I have a UISplitViewController
with a MKMapView
on the right hand side and a UITabBarController
with four tabs on the left. The app uses ARC.
Let's say we are talking about sights.
Depending on the current city the user is in, my app downloads all sights for this city to the device. Once a certain sight has been downloaded, it is stored in my local db so the user does not have to download it again. If the user searches for another city, all sights for this city will be downloaded. And so on. All saved sights will be listed inside a tableView or on a mapView, sorted by their city.
A sight consists of:
- 1-10 images
- meta info (title, subtitle, name, description, address, city, country, rating, ID, latitude, longitude... )
- it belongs to 1-n categories / tags
The app allows the user to create new sights, take pictures for it, fill in its meta info and upload it to my webserver.
All this is working fine as long as only a small number of sights has been downloaded. With 40+ sights locally saved I receive memory warnings and the app quits. The problem is that the app is meant to browse a very huge number of sights, a few hundred.
Now I would like to know some techniques to handle such memory issues.
I guess my problem is that with the start of my app, all locally saved sights are being loaded in an array as the datasource for the tableView or the mapView. But since I want to display them I see no other way than doing so.
How do other applications deal with a huge number of custom objects consisting of multiple images and a number of meta information or similar? Does some kind of best practice for handling this kind of problem exist?
Thank you very much in advance!