A local webview referring to an image downloaded to the app at runtime won't load in an iOS device but will load in the iOS Simulator, Android emulator and Android devices
I am downloading images and storing them in the apps folder here
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
I've made a simple example project, Its using Forms 4.4.0.991640
Run as is on Android for emulator and devices
Run as is for iOS Simulator
Add a valid bundle identifier and run on iOS device
iOS webview can load local files with explicit referencing
Additionally I should be able to specify BaseUrl as the local folder and use relative paths for files
iOS devices in webview fail to load local files
In the following two screenshots from Android the emulator and the physical device both can load fully defined paths, files from the assets folder and an image from an online source, they cannot load the relative file from the apps library folder or a manifest file
Android Emulator | Pixel 2 real device
:-------------------------:|:-------------------------:
|
In the following two screenshots from iOS the Simulator can load fully defined paths, files from the resources folder and an image from an online source, the real iPad device cannot load the full defined path image but can load the others
iOS Simulator | iPad real device
:-------------------------:|:-------------------------:
|
Sample project showing multiple ways of loading images into a webview
https://github.com/duindain/xamarin_ios_webview_issue
I'm just using external urls in the webview for now on iOS instead of downloading images and having them cached for the future
A previous bug i submitted to the PDF.js project has a working version of loading local files into a Forms webview in Xamarin Forms 4.1.0.555618 here
This no longer works in Xamarin Forms 4.4.0.991640
We use legacy platform specific webviews as well in our app and that loads local resources with full paths from the same folder in this bug Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
fine in Xamarin forms project v4.4.0.991640 so this issue seems specific to the Xamarin implementation in iOS of webview
When using complex local files using JavaScript, I the local page does not load. Simple HTML string text does load.
This has been a problem on iOS (12.4.5 or older - 13.x.x seems to work fine) only since 4.4 of Xamarin Forms.
I hope this gets fixed soon. It is a fairly basic need and does not currently work properly.
Is there any further progress on this?
Any update on this? I'm seeing the same issue on Xamarin forms 4.7. I'm storing downloaded files in FileSystem.CacheDirectory.
The appear correctly on device in iOS 13 but not on iOS 12.
They do appear correctly in iOS 12.4 and 11.4 simulators.
Have been this planned to be fixed soon for IOS 12.x.x?
Most helpful comment
Is there any further progress on this?