newWebView crash - short sample code

Can someone please help me figure out what I am doing wrong? This code crashes on the device when I run it more than once.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function popTheWeb (event)
        webView = native.newWebView( 0, 0, 320, 200 )
        webView:request( "http://www.anscamobile.com/" )
end
                
function webSliceGo (event)             
        webView:removeSelf()
        webView = nil
end
        
webLaunchButton = display.newRect(  200, 400, 50, 50 )
webLaunchButton:setFillColor(140, 140, 140)
webLaunchButton:addEventListener ( "tap", popTheWeb )
        
webBackButton = display.newRect(  50, 400, 50, 50 )
webBackButton:setFillColor(255, 255, 255)
webBackButton:addEventListener ( "tap", webSliceGo )

yes it crashes. not stable

But.. really? That means newWebView is unusable ever. I must be doing something wrong.

It doesn't mean "it is unusable ever" - it means it is a new feature in daily builds that we will not guarantee will work.

It takes time to get features working perfectly and daily builds are not guaranteed.

Peach :)

Hey Peach, forgive the hyperbole. The implementation I'm attempting just seemed so straightforward that I assumed (and still do, can you confirm?) that I was doing something wrong, not that the feature is actually irretrievably broken, daily build and all.

Uhm oddly enough I just built this code and ran it on the Xcode simulator and could open and close the popup multiple times without any issues however yes, it's crashing on the iPhone.

I'll try to find out where we are at with it in our next meeting.

Peach :)

Thanks for looking Peach. I'm just getting my feet wet with all this programming biz so it's a relief to know I'm not crazy :)

No worries; I'm sure it will be resolved soon :)

In any case, it was the first time I'd tried it on device and, until the crash, I thought it was very neat! So thanks, I wouldn't have checked it out yet if not for you :) (Been too busy learning about GC.)

Peach ;)

Really hope a fix comes out soon! Web popups are not working for what I need, however this is. At least in the Xcode simulator. Please get this working!!! Thanks.

fix fix fix

Did anyone submit a bug report for this?

The bug was fixed in the latest Daily Build, 736. There still is a crash problem if you try to remove the webView while a page is still loading but opening the webview and waiting for the page to load before removing is now working.

Tom,

Thanks for the update. I will test it out shortly.

Tom,

Just rebuilt for Xcode simulator and for device. I rarely crash now, once every 10 site taps, but the web site only came up once, and then crashed the app. The remainder of the times I try to pull up a site, I get a spinning circle, and the web view closes.

On the device, I get the same thing, and also it may just go to a grey screen after the spinning, or straight to the grey screen. Only once on the device did it pull up a site.

Thanks for the work so far. Hopefully we will get further as time goes on.

I've been playing with the webView API and do think it needs more work. I'm not seeing it crash that often and it does load web pages when you construct the URL correctly. It works with http://www.anscamobile.com/ but not with http://anscamobile.com/ or http://www.anscamobile.com. The last two URLs just bring up a gray window.

Also, the test code example needs some locks added or it will crash.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
local webView
 
function popTheWeb (event)
    if not webView then
        webView = native.newWebView( 0, 0, 320, 200, webListener )
        webView:request( "http://www.anscamobile.com/" )
    end
end
                
function webSliceGo (event)    
    if webView then
        webView:removeSelf()
        webView = nil
    end
end
 
        
webLaunchButton = display.newRect(  200, 400, 50, 50 )
webLaunchButton:setFillColor(200, 200, 0)
webLaunchButton:addEventListener ( "tap", popTheWeb )
        
webBackButton = display.newRect(  50, 400, 50, 50 )
webBackButton:setFillColor(0, 255, 255)
webBackButton:addEventListener ( "tap", webSliceGo )

Tom-

Thanks for the quick reply. I will tweak the URL's and see if that gets me through!

Tom-

With doing that, I was able to pull up the sites!!!! Now we just need people to do something to allow us use the links on those pages.

The pages come up fine, but the links don't work.

Jeremy,

Build 737 addresses the crash problem and looks pretty stable from my testing.

There still is an issue where sites don't load if the URL is not correctly formed. It needs to be:
"http://www.anscamoble.com/"
The "www" and the ending slash is needed or it won't load the page.

What do you mean about allowing links on those pages? Are links on web sites not working? The links on the anscamobile.com page work in webView.

Update: Can you provide a example URL that is not working?

views:2405 update:2012/2/8 8:46:10
corona forums © 2003-2011