Skip to main content
May 16, 2017
Question

air 26 StageWebView IOS 7 black screen

  • May 16, 2017
  • 2 replies
  • 735 views

Application crashes when using StageWebView on IOS 7 or lower.

I use this code:

if (StageWebView.isSupported)

{

     var webView:StageWebView = new StageWebView(/* true of false does not matter in this case*/);

     webView.stage = getStage();

     webView.viewPort = getViewPort();

     webView.loadUrl(url);

}

As a result I see black screen.

In debug mode I see exception on the line right after web view's initialization:

[Fault] exception, information=ArgumentError: Error #2004: One of the parameters is invalid.

IOS 7 does not support WKWebKit, so isn't it better to switch to UIWebKit in runtime for old versions?

Like suggests natively:

Xcode 6 + iOS 8 SDK but deploy on iOS 7 (UIWebKit & WKWebKit) - Stack Overflow

This topic has been closed for replies.

2 replies

May 18, 2017

As a temporarily workaround, I wrap this code in try/catch to detect if it's truly supported:

if (StageWebView.isSupported)

{

     var result:Boolean;

     try

     {

          var webView:StageWebView = new StageWebView();

          webView.stage = getStage(); // ios7 throws Exception

          result = true;

     }

     catch(e:Error)

     {

          result = false;

     }

     finally

     {

          webView.dispose();

          webView = null;

          return result;

     }

}

else

{

     return false;

}

But I really hope that stage web view will work using both WK or UI kits

Inspiring
May 17, 2017

If you want to support iOS 7 (or iOS 8 for that matter) you should be using an earlier version of AIR anyway, since v26 system requirements say iOS 9 and up.

May 18, 2017

I think it's incorrect at least because StageWebView.isSupported = true