简体   繁体   English

Xamarin Forms webview 根本无法在 IOS 上运行

[英]Xamarin Forms webview not working on IOS at all


I am working in a cross-platform application.我在跨平台应用程序中工作。
I use a cross-platform webview https://github.com/SKLn-Rad/Xam.Plugin.Webview我使用跨平台的 webview https://github.com/SKLn-Rad/Xam.Plugin.Webview
it is working fine on Android它在 Android 上运行良好
but nothing works on IOS但在 IOS 上没有任何效果
No events fire at all, even the "OnNavigationError" event.根本不会触发任何事件,即使是“OnNavigationError”事件。
I used a "WebRequest" to check if I can access the internet, and it works fine, no connection problems.我使用“WebRequest”来检查我是否可以访问互联网,并且运行良好,没有连接问题。
I set WidthRequest and HeightRequest for the webview.我为 webview 设置了 WidthRequest 和 HeightRequest。
also I set NS security for IOS project我还为 IOS 项目设置了 NS 安全性

    <key>NSAppTransportSecurity</key>
    <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    </dict>


I tried " https://www.google.com " and it did not work.我试过“ https://www.google.com ”,但没有用。
The problem for me is that is just silent, no errors at all.对我来说,问题是它只是沉默,根本没有错误。
Can anyone help, please?请问有人可以帮忙吗?
Regards问候

Sorry, I find the solution :)对不起,我找到了解决方案:)

I was just missing a single line in AppDelegate.cs on IOS project this is the problem's solution in case someone else faces it like me我只是在 IOS 项目的AppDelegate.cs遗漏了一行,这是问题的解决方案,以防其他人像我一样面临它

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    ..
    Xam.Plugin.WebView.iOS.FormsWebViewRenderer.Initialize();
    ..
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM