In Android we can access an HTML file from the assets (APK) via WebViewer
like this:
file:///android_asset/test.html
or
http://localhost/
But how's that for iOS? There (as far as I know) it must be accessed via the NSBundle
class.
In Android we can access an HTML file from the assets (APK) via WebViewer
like this:
file:///android_asset/test.html
or
http://localhost/
But how's that for iOS? There (as far as I know) it must be accessed via the NSBundle
class.
I'll have to double check the code, but if I recall correctly the file:///android_asset/ method is supported but not yet the http://localhost approach.
Edit: Yes, adding http://localhost support to the webviewer is issue number 518, and it's assigned to me
What a strange path:
file:///var/mobile/Containers/Data/Application/CF3D98D3-C36C-4EDC-B235-D5471745475E/Documents/AppInventor/test.html
Would this path also work with the compiled app (ipa)?
If so, what would the path be?
Yes, that logic is implemented as part of the WebViewer component itself in iOS, whereas in Android it's baked into the Android WebView. Therefore, on iOS we have complete control over how to interpret that URL.
Similar case.
In Android I had this code distinguishing if I was developing or not:
Now I don't know which direction to put the WebViewer
For iOS, you can currently use the file:///android_asset/
form, and in the next release it will also allow the http://localhost/
form, which should work on all App Inventor platforms whether you are running in live testing or compiled apps.