ITMS-90809:已弃用 API Usage-Apple 将停止接受使用 UIWebView API 的应用提交

ITMS-90809:Deprecated API Usage-Apple will stop accepting submissions of apps that use UIWebView API

我看到了一些其他标题相同的问题,但我的问题不同。

昨天,我将我的应用程序上传到 TestFlight,过了一会儿,Apple 向我发送了这个警告:

ITMS-90809:弃用 API 用法 - Apple 将停止接受使用 UIWebView APIs 的应用提交。有关详细信息,请参阅 https://developer.apple.com/documentation/uikit/uiwebview

我正在使用 WebView 在我的应用程序中显示 HTML 数据。另外,我使用 WebView 来播放音频和视频。那么,这个警告是在提交审核时拒绝我的应用程序,还是我应该用其他一些 API 更改这些功能?

在 AppStore 提供的 link 中,讲述了使用 WKWebView 而不是 UIWebView,我试过了,在 XAML 上找不到这样的 属性 .我是否需要安装任何软件包才能获得该功能?另外,通过使用WKWebView,是否可以在应用程序中播放音频、视频和显示HTML数据?

更新 1

使用自定义渲染器时获得 System.ArumentNullException。我错过了什么吗?

更新 2:渲染器代码 PCL

public class MyWebView : WebView
{
    public static readonly BindableProperty UrlProperty = BindableProperty.Create(
        propertyName: "Url",
        returnType: typeof(string),
        declaringType: typeof(MyWebView),
        defaultValue: default(string));

    public string Url
    {
        get { return (string)GetValue(UrlProperty); }
        set { SetValue(UrlProperty, value); }
    }
}

iOS 上此 class 的自定义渲染器:

[assembly: ExportRenderer(typeof(MyWebView), typeof(MyWebViewRenderer))]
namespace WKWebViewDemo.iOS
{
    public class MyWebViewRenderer : ViewRenderer<MyWebView, WKWebView>
    {
        WKWebView _wkWebView;
        protected override void OnElementChanged(ElementChangedEventArgs<MyWebView> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                var config = new WKWebViewConfiguration();
                _wkWebView = new WKWebView(Frame, config);
                SetNativeControl(_wkWebView);
            }
            if (e.NewElement != null)
            {
                Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.Url)));
            }
        }
    }
}

XAML

<StackLayout>
    <local:MyWebView Url="https://www.microsoft.com" VerticalOptions="FillAndExpand"/>
</StackLayout>

更新

这个问题已经解决,解决方案可以在下面的答案中找到

ITMS-90909: Deprecated API Usage with iOS in Xamarin Forms app

这是 Xamarin.Forms 在 Github

的一个未解决的错误

截至目前,我没有在线程中看到任何解决方法或其他内容,但您可以等待 Xamarin.Forms

的下一版本修复它

更新:看到了一个可能有效的解决方法检查这个https://github.com/xamarin/Xamarin.Forms/issues/7323#issuecomment-527294907