fix(ios): Allow loading local html files#693
Conversation
|
We use github issues now instead of JIRA, that's why you couldn't report the problem there. Can you provide a sample app where the issue can be reproduced? I've tried loading a photo from file url and worked fine with existing code. |
|
Hi jcesarmobile, I created this project for you: https://github.com/dpalou/iab-file-error I included the node_modules and plugins in there, but not the platform. Just add the iOS platform, run the app and click the "Click me" button. I got the same error I described in the Pull Request, you can see the error in the Xcode console. Thanks! |
jcesarmobile
left a comment
There was a problem hiding this comment.
Verified that fix the html file loading and doesn't break loading image files (i.e, from camera plugin result), so merging, thanks for contributting!
|
I've created pull request for this pull request that addresses additional limitations imposed to loading of local storage on iOS. |
Platforms affected
iOS
Motivation and Context
Opening a local HTML file with InAppBrowser and UIWebView works fine, but the same code with WKWebView throws an error:
This Pull request is meant to fix that. I'm not an iOS developer, so I'm not sure if the allowingReadAccessToURL param should be more flexible or even configurable by options, but the change seemed to work in my case.
I tried opening an issue in the tracker, but I couldn't select the Apache Cordova project when creating the issue, I guess I lack some permissions.
Description
I read that in WKWebView the function to load files is loadFileURL instead of loadRequest, so I'm using that function if the URL scheme is "file".
Testing
I've executed "npm run tests" and no error was displayed (no success message either, so I'm not 100% sure it worked).
I've tested this in our project but with the 3.2.0 version instead of master branch, so this should have a more intensive testing.
Checklist
(platform)if this change only applies to one platform (e.g.(android))