CordovaSQLite not working in iOS


#1

I am using a Windows 7 64 bit computer and a 2015 Mac Mini to compile the same app for Android (4.1.1 and above) and iOS (8 and above). Both environments are working from the same code base.

I have the following plugins installed:

  • com.synconset.imagepicket 1.0.7
  • cordova-plugin-camera 1.2.0
  • cordova-plugin-crosswalk-webview 1.0.0
  • cordoba-plugin-file 3.0.0
  • cordova-plugin-geolocation 1.0.1
  • cordova-plugin-google-analytics 0.8.1
  • cordova-plugin-inappbrowser 1.1.1
  • cordova-plugin-network-information 1.1.0
  • cordova-plugin-whitelist 1.0.0
  • cordova-sqlite-storage 0.7.15-pre

I also have the following folders in www/lib:

  • angular
  • angular-animate
  • angular-cookies
  • angular-sanitize
  • angular-ui-router
  • angularLocalStorage
  • ionic
  • moment
  • moment-timezone
  • ngCordova
  • ngstorage

My version of Cordova is 5.4.1.

My app opens a database at certain points within app.js and services.js (app.js is loaded before services.js in my index.html file):

db = $cordovaSQLite.openDB("mydb.db");

Any and all calls to the database, including those contained within $ionicPlatform.ready() inside app.js, work fine on Android, but fail on iOS. I have tried using cordovaSQLite on a generation 2 iPad with iOS 9.2 as well as an iPhone 6s Plus in Simulator. Simulator returns the following error when inspecting in Safari:

Error: undefined is not an object(evaluating 'n.sqlitePlugin.openDatabase')
openDB@file:///<...>ng-cordova.min.js:9:17883

None of the usual answers on this topic have been of any help to me since most topics seem to be solved by just wrapping in $ionicPlatform.ready(), but I’ve already done that and it only works on one platform. Can anyone please point me in the right direction to solve this discrepancy?

Thanks in advance.


#2

I am having the exact same issue, did you ever solve this?


#3

On iOS most of my problems went away by closing XCode, opening Terminal, and executing:

ionic platform remove iOS

ionic platform add iOS

cordova prepare