First launch and background import

When I designed bible app, I wanted to provide the beat offline reading experience. Offline app usually needs to face a first launch problem. It needs to download a bunch of data or initialize from local resources.

There are many ways to store scriptures data. I chose core data due to low memory footprint and simplicity of code.

I wanted to implement batch import in background while allows user interface to work responsively . My first idea was separating the scriptures database and user data (note, highlight and history). While scriptures data is on private queue and user data is on main queue.

Everything worked well but I found there was a random bug when fetching from private queue. The execution time just could not be predicted which caused other bugs (the execution order was assumed, so it required much more effort to make it the codes independent).

Finally I decided to give up the non blocking user interface and require user to wait until the whole verses library to be loaded. To avoid unnecessary loading time, only load the specific version when user switches to.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: