I saw some other questions with same title, but my question is different.
Yesterday, I uploaded my App to TestFlight and after a while, Apple sent me this warning:
ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs. See https://developer.apple.com/documentation/uikit/uiwebview for more information.
I am using WebView
for showing HTML data in my app. Also, I have used WebView
for playing audio and video. So is this warning reject my app when submitting for review or should I change these features with some other APIs?
In this link provided by AppStore, telling about use WKWebView
instead of UIWebView
, I tried that and no such property found on XAML. Should I need to install any packages for getting that feature? Also, by using WKWebView
, is it possible to play audio, video and showing HTML data in the app?
Update 1
Getting System.ArumentNullException
when work with the custom renderer. Am I missing something?
Update 2: Renderer Codes 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); }
}
}
The custom renderer for this class on iOS:
[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>