Recently, I am working on Xamarin Forms project. I believe you are unfamiliar with Xamarin. In fact, it is also a cross platform technology. Please refer to the following official document to understand.
Xamarin.Forms is an open-source UI framework. Xamarin.Forms allows developers to build Android, iOS, and Windows applications from a single shared codebase.
Xamarin.Forms allows developers to create user interfaces in XAML with code-behind in C#. These interfaces are rendered as performant native controls on each platform.
Well, I won't say much about it. In a word, it's a cross platform technology.
Today's Bug is that you need to customize a WKWebView in iOS during project development. You may wonder why you need to customize WKWebView in iOS. You can take a look at the introduction of the following document:
WebViewis a view that displays web and HTML content in your app. This article explains how to create a custom renderer that extends the
No doubt, it's true that the interface that Forms can't implement needs to call iOS native methods through Renderer, which is similar to writing native methods with C ා. If you know more about Forms, you need to use Renderer to write the interface in many scenes.
OK, here I post the document of Custom WebView, so my problem also occurs when realizing this function. The Bug is as follows:
**Foundation.You_Should_Not_Call_base_In_This_Method:** 'Exception of type 'Foundation.You_Should_Not_Call_base_In_This_Method' was thrown.'
At the same time, the interface of Visual Studio becomes the following:
When you see this, you are very confused, because there is no console log to show where the problem is. But remember, I wrote a few lines of code before this Bug happened, that's all.
Therefore, Check the code written and use NavigationDelegate in WKWebView, which is the result of adding it. The locking problem code is as follows:
So you should not call base in this method according to the prompt of Error. Now you know the reason. There are many ways
Just remove this method.
However, we can't understand the Error prompt in a short time, so you can search the Error on Google and find the official Error explanation as follows:
This class exits purely as a warning to future generations. You called a method using "base", but this was not required.
So, in the end, this Bug was solved.