且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Xamarin Forms 4.4 + 中是否仍需要此 ExportRenderer?

更新时间:2023-11-28 14:39:58

来自最新的 webView 的文档WKWebView 替换了 UIWebViewXamarin.forms 4.5:

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

从 2020 年 4 月开始,Apple 将拒绝仍然使用不推荐使用的 UIWebView API.虽然 Xamarin.Forms 已切换到WKWebView为默认,还有对旧SDK的引用在 Xamarin.Forms 二进制文件中.当前的 iOS 链接器行为没有删除它,因此不推荐使用的 UIWebView API 仍然会当您提交到应用程序时,似乎从您的应用程序中引用存储.

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.

链接器的预览版本可用于解决此问题.到启用预览,您需要提供一个额外的参数--optimize=experimental-xforms-product-type 到链接器.

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.

此操作的先决条件是:

  • Xamarin.Forms 4.5 或更高版本 – Xamarin.Forms 的预发布版本4.5 可以使用.
  • Xamarin.iOS 13.10.0.17 或更高版本 – 检查您的 Xamarin.iOS 版本视觉工作室.此版本的 Xamarin.iOS 包含在 Visual适用于 Mac 8.4.1 和 Visual Studio 16.4.3 的 Studio.
  • 删除对 UIWebView 的引用 – 您的代码不应包含任何对 UIWebView 或任何使用 UIWebView 的类的引用.
  • 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.

看看这个主题会有所帮助.

对于您的第一个问题,我认为 Xamarin.forms 4.5+ 中不再需要它.

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

关于你的第二个问题,如果你有任何问题,你可以在 Xamarin.forms 的 Github 中打开一个问题.

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