flutter_inappbrowser库在IOS中无法加载远程地址

发布于 1周前 作者 phonegap100 来自 分享

flutter_inappbrowser库在IOS中无法加载远程地址的解决方法

flutter中使用webview,用了 flutter_inappbrowser 这个库,Android端显示正常,iOS出不来,最初网上找大多数都是说是因为没有添加对http请求的信任,需要在info里面添加

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

但是试过之后没有,后来一阵折腾,在官方库的文档中找到

InAppWebView: Flutter Widget for adding an inline native WebView integrated into the flutter widget tree. To use InAppWebView class on iOS you need to opt-in for the embedded views preview by adding a boolean property to the app’s Info.plist file, with the key io.flutter.embedded_views_preview and the value YES. 就是说在info添加 io.flutter.embedded_views_preview为 true 就行了

<plist version="1.0">
<dict>
        ...
    <key>io.flutter.embedded_views_preview</key>
    <true/>
</dict>
</plist>

使用各种类库之前先看认真文档、说明很重要。


更多关于flutter_inappbrowser库在IOS中无法加载远程地址的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html

回到顶部
AI 助手
你好,我是IT营的 AI 助手
您可以尝试点击下方的快捷入口开启体验!