0

I have a Cordova iOS app that makes a call to window.openDatabase() in the onDeviceReady() event handler. It seems execution of the onDeviceReady() event handler stops on that line, because my console.log() beneath that line never show up in the debug console in Xcode. Neither do any other error messages.

The same code works fine on Android devices and Chrome/Ripple emulator. What is wrong?

var db = null;

// PhoneGap is ready
function onDeviceReady() {
    console.log("onDeviceReady");

    db = window.openDatabase("mydb", "1.0", "My DB", 100000000);        

    console.log("This will never be displayed in Xcode log");

    db.transaction(checkDB, checkErrorCB);        
}

Cordova version: 2.3.0

Xcode version: 4.5.2

I am testing on iPhone 5.1 and iPhone 6.0 simulator.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Magnus
  • 17,157
  • 19
  • 104
  • 189
  • the WebKit DB in IOS is limited to 5 Mb, for more info read this answer. http://stackoverflow.com/questions/9118757/max-size-of-websql-sqlite-database-inside-uiwebview-phonegap – T.Baba Jan 15 '13 at 07:16

1 Answers1

2

Doh!!

Seems the DB size I specified was to big, it all started working when I removed a zero... That's the kind of thing that's easy to overlook when you've been looking at the same code for weeks and it's been working fine. I just picked a random large number "to be on the safe side".

This code is working:

db = window.openDatabase("mydb", "1.0", "My DB", 10000000);
Magnus
  • 17,157
  • 19
  • 104
  • 189