Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

@trygve-lie
Copy link
Contributor

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
Copy link
Member

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants