gree / unity-webview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to load local files with XHR on iOS

NonSpicyBurrito opened this issue · comments

I'm unable to load local files (file://...) with XMLHttpRequest in JS, to files in either Application.persistentDataPath or Application.temporaryCachePath. The same code works fine on Android.

Possibly relevant: https://stackoverflow.com/questions/35554814/wkwebview-xmlhttprequest-with-file-url
It seems that the solution is to add allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs to configuration preferences.

I introduced UNITYWEBVIEW_IOS_ALLOW_FILE_URLS in #788 for enabling allowFileAccessFromFileURLs and allowUniversalAccessFromFileURLs, and updated binaries. You can enable these settings by defining UNITYWEBVIEW_IOS_ALLOW_FILE_URLS. Please note, however, that these are private APIs so the app enabling them may be rejected.

Thank you for the swift work.