WebView just shows a blank page

Hi everyone,

After having some problems with WebPopup, I want to try WebView, but that just flat out isn’t working for me. I used this code:
[lua]local webView = native.newWebView( 0, 0, 320, 250 )
webView:request( “http://www.anscamobile.com” )[/lua]
and the result is just a black page. Any idea why? [import]uid: 102175 topic_id: 28831 reply_id: 328831[/import]

Are you developing for iOS or Android?

The native.newWebView API is only available for iOS devices (at this time) and is part of the Daily Builds starting with build 730. It is not available in the Release Build (704).

Um, I’m subscribed for Android, but am currently preparing an app in iOs in trial mode. Does that make a difference?

PS and I’m using the Jul19 build. [import]uid: 102175 topic_id: 28831 reply_id: 116238[/import]

The [lua]native.newWebView()[/lua] function is only supported on iOS at the moment. It is not supported on Android… yet. We plan on adding support for this API to Android in a daily build by next week.

If you can’t wait until then, then you can use [lua]native.showWebPopup()[/lua] instead which is support on both mobile platforms. [import]uid: 32256 topic_id: 28831 reply_id: 116267[/import]

But I am trying it on iOs, only in trial mode. I believe I mentioned that in my previous post. [import]uid: 102175 topic_id: 28831 reply_id: 116311[/import]

April,

I just tried displaying a WebView on iOS and it is working for me. Are you sure your iOS device has Internet access? You might want to double check via your device’s web browser. You should also set up an urlRequest listener in your code to see if it is failing to load the page.

Also, the Corona Simulator does not support WebViews yet. Even when displaying it via an iOS device skin. [import]uid: 32256 topic_id: 28831 reply_id: 116762[/import]

Thanks Joshua, I just discovered yesterday and didn’t have time to write back - the problem was I was only trying it in the simulator. Works fine on the device, except that it’s even less responsive than the WebPopup - I’m still trying to solve my problem of opening iTunes from an online page :confused: [import]uid: 102175 topic_id: 28831 reply_id: 116857[/import]

I assume that you are talking about the Xcode device simulator? That might be slow. On an actual iOS device, WebViews are quite fast. Although, perhaps the iTunes website is a bit too taxing on the mobile browser or requires extensions that the mobile browser does not have. Have you tried going to your iTunes page via the iOS device Safari app? Is it any better?

If you are trying to get your app to display its iTunes page so that your customers can rate it, there is a much easier way to do this. You can use [lua]system.openURL()[/lua] and display your app’s iTunes page via the App Store application itself. My understanding is that is how Apple wants everyone to do it. The following website can generate the link to your app…
http://itunes.apple.com/linkmaker/
[import]uid: 32256 topic_id: 28831 reply_id: 116945[/import]

[lua]system.openURL()[/lua] works if you already know the app’s address, but I want a dynamic webpage that I can add apps to without needing to update every time. itms://itunes.apple.com links (like here: http://light-sleepers.com/otherbooks/otherbooks.htm) work from Safari on the device, but not from the webPopup, and even less from the webView. [import]uid: 102175 topic_id: 28831 reply_id: 116965[/import]