Start a new topic

Xamarin iOS - Local image in HTMLDrawable

Hello,


I have a requirement which is to be able to fetch the AR contents from our CMS and save them locally on the app's "Personal" folder to then load them later in AR. This works well for wt3 and wto used as 3d models and target collection resources. I'm passing the path values from Xamarin into the JS using CallJavaScript.


But I've run into a problem. When I try to use a HTMLDrawable with an image that has a souce pointing to a local file it doesn't work. If I use the path I obtained from xamarin path functions in the img src, starting with "/var/mobile/Contaniers...", it doesn't load the image. If I prepend the prefix "file://" the app crashes. If I use a image hosted on a webserver it works as expected. Also, on Android it works fine with a local file's path. The path I'm using (on iOS) is correct, as I can show the image on a xamarin page using that path, just not on the HTMLDrawable. It is also arriving on the HTMLDrawable correctly, as I can check it by writing it in a span.


I suspect it may have something to do with the webview used to load the HTML not having the right configuration or permissions to allow access to local files, but its just a guess.


Is there a way I can make this work? It seems to me I'm not the first person with this requirement but I've searched and didn't find anyone with a problem in local images on HTMLDrawables.


I'm using the xamarin JS SDK 9.7.0 and my app is running on iPhone 11 Pro Max with iOS version 12.6.


Thanks!

Login or Signup to post a comment