Rg.Plugins.Popup: simple popup with webview crashes on iOS

Hi guys, need help with something, don’t know what is happening. I have a simple popup page in my xamarin form project:

<StackLayout  >
            <WebView x:Name="myWebView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
            </WebView>
    </StackLayout>

Right now I’m passing the string url after InitializeComponent() in xaml.cs file: myWebView.Source = new UrlWebViewSource { Url = url};

And I call this within a TapGestureRecognizer Navigation.PushPopupAsync(new MyPopUpPage("https://my-url..."));

and I got the following error (nothing but this on stacktrace):

iOS[35217:341188] void _WebThreadLock(), 0x129b7b040: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now…

I already tried with the latest pre-release version (1.1.4.154-pre) on iOS but still has the same error. Any clue? What am I missing? This code is working fine on Droid, only has this error on iOS

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I found the solution,

If you run in main thread will solve the issue as below.

Device.BeginInvokeOnMainThread(async () => { await Navigation.PushPopupAsync(page, false); });

Thanks