Pouch is broken when running in iOS WebView when built with Cordova/PhoneGap #4756

Closed
trygve-lie opened this Issue Jan 7, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@trygve-lie
Contributor

trygve-lie commented Jan 7, 2016

This issue has been discussed and solved on slack but this is the essential issue:

The following does not create a database in iOS (WebView) when built with Cordova/PhoneGap:

var db = new PouchDB('myDB');

The above code does work when running it in Safari on the same iOS device. The following does also work when build for Android (WebView) with Cordova/PhoneGap.

Iow: this is Cordova / PhoneGap iOS WebView specific issue. The rest of this issue refer to this environment only.

The above code will not create a database, and the created event will not fire. Appending an adaptor for specific telling Pouch to use ex websql does not work either. None of the API methods will perform correctly either.

Ex, doing a simple insert will fail silently:

db.put({_id: 'test'}).then(function(result) { 
    console.log('I wrote', result); 
});

Though, trying to create a database this way:

var db = new PouchDB('myDB', function(err, db) { 
    console.log(err, db);
});

yelds the following error message:

"TypeError: cordova.fireWindowEvent is not a function. (In 'cordova.fireWindowEvent(opts.name + "_pouch", {})', cordova.fireWindowEvent' is undefined);"

Removing this block and this block does resolve the issue and Pouch works as expected.

A big thank you to @daleharvey for helping out debugging and resolving this issue on slack!! Mucho tusen takk!

trygve-lie added a commit to trygve-lie/pouchdb that referenced this issue Jan 7, 2016

trygve-lie added a commit to trygve-lie/pouchdb that referenced this issue Jan 7, 2016

@daleharvey

This comment has been minimized.

Show comment
Hide comment
@daleharvey

daleharvey Jan 8, 2016

Member

Fixed in b94f4b8, Mange takk til deg :)

Member

daleharvey commented Jan 8, 2016

Fixed in b94f4b8, Mange takk til deg :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment