Xamarin Forms 4.4 + 中是否仍需要此 ExportRenderer? [英] Is this ExportRenderer still required in Xamarin Forms 4.4 +

查看:34
本文介绍了Xamarin Forms 4.4 + 中是否仍需要此 ExportRenderer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个关于 Xamarin Forms 中的 WKWebview 的问题

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

1) 来自 https://github.com/xamarin/Xamarin.Forms/拉/3346:

要选择使用 WkWebView,请将以下内容添加到 iOS C# 项目文件的 AssemlyInfo.cs 文件中

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))]

在 Xamarin Forms 4.4 中是否仍然需要使用此程序集?显然 WKWebView 是 XF4.4 中的默认视图,所以没有必要吗?

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) UIWebView 和 WKWebview 之间是否有任何视觉变化?我将我的应用程序从 XF3.4 更新到 4.4,因为我听说了 WebView 更改,但似乎没有任何视觉差异,但是 4.4 中有一个奇怪的错误,加载图标不会从中间消失即使我的页面似乎已正确加载,我的屏幕...

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...

谢谢!

推荐答案

来自最新的 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.

这篇关于Xamarin Forms 4.4 + 中是否仍需要此 ExportRenderer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆