Ios 在webview中,尝试嵌入平台视图时出现如下错误,但PaintContext不支持嵌入
在my info.plist文件中添加了密钥 io.flatter.embedded\u视图\u预览=是 在webview中加载base 64转换的html字符串。它在室内工作得很好 安卓,但iOS,我在上面提到的问题上出错了Ios 在webview中,尝试嵌入平台视图时出现如下错误,但PaintContext不支持嵌入,ios,flutter,webview,wkwebview,Ios,Flutter,Webview,Wkwebview,在my info.plist文件中添加了密钥 io.flatter.embedded\u视图\u预览=是 在webview中加载base 64转换的html字符串。它在室内工作得很好 安卓,但iOS,我在上面提到的问题上出错了 String htmlText=getHTML(cp); 最终字符串contentBase64=base64Encode(const Utf8Encoder().convert(htmlText)); 字符串url='数据:text/html;base64,$conten
String htmlText=getHTML(cp);
最终字符串contentBase64=base64Encode(const Utf8Encoder().convert(htmlText));
字符串url='数据:text/html;base64,$contentBase64';
this.child=WebView(
initialUrl:url,
javascriptMode:javascriptMode.unrestricted,
JavaScriptChannel:[
_cpJavascriptChannel(buildContext,cp),
].toSet(),
onWebViewCreated:(WebViewController WebViewController){
_控制器。完成(webViewController);
},
navigationDelegate:(NavigationRequest请求){返回NavigationDecision.prevent;}
);
JavascriptChannel\u cpJavascriptChannel(构建上下文上下文,chargePoints.ChargePoint cp){
返回JavascriptChannel(
名称:“充电桩”,
onMessageReceived:(JavascriptMessage消息){
Navigator.of(buildContext.pushReplacementNamed(“/chargePoint”,参数:{'cp':cp,'connector':message.message});
});
}
以下是帮助我解决此问题的代码
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
io.flatter.embedded\u视图\u预览
NSAllowsArbilarLoadsInWebContent
您还可以从中阅读有关新更改的更多信息
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>