-
Notifications
You must be signed in to change notification settings - Fork 33
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
Local files in iOS #11
Comments
I think this is a bug in this library's use of ajax, and what I ought to do is update to use the latest pouchdb-style browser ajax module. Sorry you ran into that! |
@vpease I've reopened the issue. Can you provide a test case to reproduce and/or a pull request on the |
The error is only in Cordova running under iOS. i was able to check again the release 1.3.2 with Cordova under iOS and Android. line 1190: Line 1639: In both lines an additional or condition is needed to handle one additional non error situation. It seems that under Cordova, iOS always return 0 for the status on a xmlhttprequest object. I will try under Windows IE and WP later today and post the results. |
Hmm, I'd prefer to figure out why the |
OS: Mac OS X Yosemite file location: local file inside www\data directory . calling the load with this line: cache:true is necessary to avoid the '?nonce...' at the end of the file. Error generated in any other case. When using a local server to host the file, the code works with no modifications. Situation is generated only with local files. Android working fine with local files with no modifications. |
Same here. The error in console:
Using:
File location: inside www/js/data Tested with splitted files too, and with small database (20kb), the error is the same. my config:
The error is just in iOS. In Android 4.4.4 and web via ionic serve works OK. |
closing in favor of pouchdb/pouchdb#3763 |
BTW there is also another workaround now: |
Leaving this open for visibility. |
So what is the fix here? Still cant get this to work |
The fix is to load the file yourself using some Ajax library and then load the string directly into |
I figured. Thx |
check my code in a comment on 23 feb but be careful because that means to modify the library and sniff the content in the response. Only working with v1.3.2. The same approach can be applied on new releases: i was able to check again the release 1.3.2 with Cordova under iOS and Android. line 1190: Line 1639: In both lines an additional or condition is needed to handle one additional non error situation. It seems that under Cordova, iOS always return 0 for the status on a xmlhttprequest object. I will try under Windows IE and WP later today and post the results. |
@vpease Thank you for your comment, but please, it is much less useful to paste code into a Github comment than to open a PR. When you open a PR, the tests are re-run automatically, so even if you don't submit a new test with your fix, we can at least verify that there's no regression. |
I've run into this problem on iOS 9. I get {status: 0, name: "unknown", message: undefined} when I try to load from a URL. I've tried to load a string from the output of |
I solved this issue with the hack recommended by vpease. Thanks! |
For local files, you can just use the filename and path in the url but for iOS a modification must be done.
line 188:
if ((xhr.status >= 200 && xhr.status < 300) || (xhr.status==0 && xhr.responseText.length>0) ) {
the additional or condition is because for some reason, iOS is returning 0 as the status for the xhr request even when there is data loaded from file. Maybe this is because file is not http but anyway now its working for Android, WP and iOS.
The text was updated successfully, but these errors were encountered: