ios - -canOpenURL:URL 失败:“file:///var/containers/Bundle/Application/{path}” - 错误:“操作
问题描述
我正在将一个 HTML 文件加载到我的应用程序中并向用户显示一些信息。HTML 文件是我的应用程序捆绑资源的一部分。我在控制台中注意到以下错误:
-canOpenURL: failed for URL: "file:///var/containers/Bundle/Application/{somePath}/" - error: "This app is not allowed to query for scheme file"
那么,我在 info.plist 中添加了以下键:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>file</string>
</array>
我得到一个不同的错误:
-canOpenURL: failed for URL: "file:///var/containers/Bundle/Application/{somePath}/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
即使我收到此错误,我也可以毫无问题地打开 HTML 文件。
你们有任何提示如何解决这个错误吗?
解决方案
<WebView
originWhitelist={['*']}
source={{ html: '<h1>Hello world</h1>' }}
/>
originWhitelist={['*']}
解决了我的问题
推荐阅读
- typescript - 如何在 observable 内部有条件地订阅,等待响应并返回完整结果?
- docker - 从 docker 中运行的 .NET Core 应用程序连接到本地 SQL Server
- xamarin - 嵌套选项卡视图未绑定到单独的 ViewModel
- java - 在自动生成的 Excel 文件中添加颜色
- php - 未经身份验证的子页面的PHP Laravel保护路由
- wso2is - 如何在 wso2 api 管理器中添加额外的标题和值?
- php - 在 symfony 4 中使用 pdo 会话时,有什么方法可以将自定义列添加到会话表中?
- nsis - 如何限制 NSIS 中的文本框字符数
- javascript - 检查数组是否包含两个特定值
- sql - Solr4.10.3中的值如何求和