WebView for internal html pages not working in the device
I am trying to run a web app inside a Titanium WebView and, in the emulator, it works perfectly, even for Android. When I compile the project and install the IPA file in my iPhone 4, the App opens but nothing comes up. Only a white screen.
Are the resource files (html, images, etc) need to be placed in a different folder when the app is compiled for iPhone to read them?
3 Answers
-
as long as the internal html files you user are placed in the resources folder of your titanium project everything should be fine. I did this before and never had problems with it.
-
I am also struggling with this issue. It seems to be a pretty complicated set of variables; it doesn't occur when the WebView is at the top level (a SplitWindow), but does in windows created later. It's also specific to local HTML files displayed using the "url" property. I'm hypothesizing this has something to do with the Resources directory structure.
I'm currently working around the issue by reading the HTML through the filesystem API and passing it to the view:
var htmlFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'html', 'index.html'); var webView = Ti.UI.createWebView({ html: htmlFile.read().text, scalesPageToFit: false });
Maybe this will work for you?
-
Also take in account that the device is case sensitive while the emulator is not. So pay attention on the filename to have the same case ( index.html <> index.HTML )