1

I'm building an app which requires 1.8GB of resources. It's an enterprise app which will be installed in a controlled environment. The resources need to be on the device from the start as it will be used without network coverage.

The resources are specialist map tiles which are in the form of hundreds of PNG images, contained in semantically relevant folders.

When including these directly in the project, via folder references (as the images are retrieved using a derived path) Xcode slows to a crawl (due to indexing and maintaining a project of that complexity) and installation on a test device takes forever. This can be mitigated by removing the images after the first build (so they are still on the device) but that's not ideal. Additionally, when they're in the project, the bundle size is huge and this causes problems with deployment (not only download times, but it seems to fail quite often when downloading from our internal Apperian app store, presumably due to the sheer size).

I've experimented with distributing the app without the resources and having it download them, if required, on first run as a zip file. Unfortunately unzipping the resources takes an unsustainable amount of time.

How can I hit the sweet spot between an easy-to-manage project in Xcode, a small distribution package, and a manageable first-run experience? I'm happy for the iPad to be sat there for half an hour or so when the app is first installed, but any longer than that is not going to work. Is there a better way than using a zip file for the resources?

jrturton
  • 118,105
  • 32
  • 252
  • 268
  • If they are map tiles, why don't you just load each tile as needed and cache them? Downloading and unpacking 1.8 GB file is a pretty bad idea on a mobile device. – ian Jul 07 '14 at 08:23
  • @ian sorry, I should have mentioned that. The app requires full offline access to all of the tiles. – jrturton Jul 07 '14 at 08:28
  • May want to consider a separate content-loader method within your app, as bundling the resources is not practical. This will keep the app size down, allowing efficient deployment/upgrade, as well as providing you flexibility on optimizing content delivery (eg. @sergio suggestion of breaking up archives) Only allow content-loader when on Wifi, async/lazy load using background threads, maybe allow UI tutorial/upgrade notes/user feedback while initial content load is occurring in background...just some thoughts. – gro Jul 07 '14 at 15:08

1 Answers1

1

I've experimented with distributing the app without the resources and having it download them, if required, on first run as a zip file. Unfortunately unzipping the resources takes an unsustainable amount of time.

PNG files are highly compressed, so you do not get a real benefit by zipping them. You could archive them in a tar ball, instead, and unarchiving would be much faster. Maybe, zip has also an archive-without-compression option.

An orthogonal strategy could be, instead of having just one archive, having multiple archives. Then, you could download/unarchive them in a given order so to allow the app to be functional quickly while doing the rest of downloading/unarchiving in background. Whether this is feasible will depend on you app, in the end. Since you say that folders have a semantics, you could archive folders (individually or in groups), then on first launch, ask the user which folder he would like to start working with (if it makes sense), and download that one first.

sergio
  • 68,819
  • 11
  • 102
  • 123
  • They all need to be there so I need it in one big bang. When you say "ideally" for zips, do you mean that is preferable to a tar ball? – jrturton Jul 07 '14 at 08:29
  • Sorry, I meant "maybe"… "ideally", so you do not have to change radically what you are doing right now, you just change an option -- you have to check which (tar vs. zip) performs better… – sergio Jul 07 '14 at 08:38
  • Uncompressed zip and some tweaks to the unzipping library I was using to improve performance has done the trick. Thanks! A 1.8GB zip containing almost a million files unzipped in 50 minutes, which is acceptable. – jrturton Jul 09 '14 at 21:42