0
votes

I have a couple of questions about the WKWebview in Xamarin Forms

1) From https://github.com/xamarin/Xamarin.Forms/pull/3346:

To opt-in to using WkWebView add the following to the AssemlyInfo.cs file of your iOS C# project file

[assembly: ExportRenderer(typeof(WebView), typeof(Xamarin.Forms.Platform.iOS.WkWebViewRenderer))]

Is this assembly still necessary to use in Xamarin Forms 4.4? Apparently WKWebView is the default view in XF4.4 so it's unnecessary?

2) Are there any visual changes between the UIWebView and the WKWebview? I updated my app from XF3.4 to 4.4 because I heard of the WebView change, but there doesn't seem to be any visual difference, but there is one weird bug in 4.4 where the loading icon won't disappear from the middle of my screen even though my page appears to have loaded properly...

Thanks!

1

1 Answers

0
votes

From the latest document of webView, WKWebView has replaced UIWebView since Xamarin.forms 4.5:

Starting in April 2020, Apple will reject apps that still use the deprecated UIWebView API. While Xamarin.Forms has switched to WKWebView as the default, there is still a reference to the older SDK in the Xamarin.Forms binaries. Current iOS linker behavior does not remove this, and as a result the deprecated UIWebView API will still appear to be referenced from your app when you submit to the App Store.

A preview version of the linker is available to fix this issue. To enable the preview, you will need to supply an additional argument --optimize=experimental-xforms-product-type to the linker.

The prerequisites for this to work are:

  • Xamarin.Forms 4.5 or higher – Pre-release versions of Xamarin.Forms 4.5 can be used.
  • Xamarin.iOS 13.10.0.17 or higher – Check your Xamarin.iOS version in Visual Studio. This version of Xamarin.iOS is included with Visual Studio for Mac 8.4.1 and Visual Studio 16.4.3.
  • Remove references to UIWebView – Your code should not have any references to UIWebView or any classes that make use of UIWebView.

Have a look at this thread would help.

For your first question, I think it is no longer needed in Xamarin.forms 4.5+.

For your second question, if you have any question, you can open an issue in Github of Xamarin.forms.