Hybrid Cordova iOS app: possible cache

If you are building hybrid app you need to remove / add platform from time to time. We got an issue with Cordova SQLite plugin.

Cordova iOS app got frozen while inserting 100+ records. It might freeze on 146 transaction or on 206 transaction. Total transactions were 506.

While testing in Xcode console we saw following output:

2015-07-23 23:22:05.551 Wp[1890:297164] void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

2015-07-23 23:22:38.648 Wp[1890:297111] Received memory warning.

2015-07-23 23:23:12.838 Wp[1890:297111] Received memory warning.

2015-07-23 23:23:21.885 Wp[1890:297111] Received memory warning.

2015-07-23 23:23:21.921 Wp[1890:297111] Received memory warning.

2015-07-23 23:23:22.279 Wp[1890:297111] Received memory warning.

2015-07-23 23:23:23.541 Wp[1890:297111] Received memory warning.

There were simple insert queries per transaction like this:

INSERT INTO friends (user_id, server_id, fname, lname, email, phone, phone2, photo, photo_medium, local_photo, bday, bmonth, byear, vk_url, vk_id, fb_url, fb_id, ok_url, ok_id, phone_id, hide_birthday_event, related_user, merged_contacts, modified) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)

Issue was resolved by removing then adding ios platform and reinstalling all plugins.

In our app we use following plugins:

$ cordova plugins ls

com.phonegap.plugins.PushPlugin 2.5.0 "PushPlugin"

com.phonegap.plugins.facebookconnect 0.11.0 "Facebook Connect"

cordova-plugin-camera 1.2.0 "Camera"

cordova-plugin-contacts 1.1.0 "Contacts"

cordova-plugin-device 1.0.1 "Device"

cordova-plugin-file 2.1.0 "File"

cordova-plugin-file-transfer 1.2.1 "File Transfer"

cordova-plugin-globalization 1.0.1 "Globalization"

cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"

cordova-plugin-media 1.0.1 "Media"

cordova-plugin-network-information 1.0.1 "Network Information"

cordova-plugin-whitelist 1.0.0 "Whitelist"

io.litehelpers.cordova.sqlite 0.7.10-pre "Cordova sqlite storage plugin"

Initially I thought some plugin may use too much memory. I created new app in cordova, added just SQLite plugin. Then step by step was adding each plugin. I was surprised there was no any crashes even if I was adding 40000 records!

After set of tests I decided to remove then add platform as well as all plugins in our main app. That helped. App interfaces works much more faster now.