I’m writing a magazine app for iPad. And while view loading and drawing shelves with issues, I need to add “buy”-, “download”- or “read”-button issue depending on saved state.
But according to apple documentation, device can remove any downloadable data, so i have to check if file exist in a loop for each issue. That’s very expensive operation and app loads very long.
Any ideas how to optimize it or how to avoid it, saving functionality?
You should try to check them asynchronously for every issue, while displaying some loading icon or something on each magazine as if your app was “thinking” if it has it or not.
If you aren’t displaying a very large number of issues at the same time, you could check them on demand, that way you won’t be checking for hundreds of files on your file system.
Also, device can remove downloadble data, but it’s not normal. If you move your files in your documents folder, you should be fine most of the time.
Also, I dunno how you are checking for the file’s existence, but just to make sure, use