【发布时间】:2020-01-29 17:49:23
【问题描述】:
2020-01-29 20:32:22.470194+0300 Myapp[8905:2391245]
-canOpenURL: failed for URL: "file:///private/var/containers/Bundle/Application/146EA027-7A**/Myapp.app/assets/src/assets/policy.html" - error: "This app is not allowed to query for scheme file"
我在 真实设备 上的 xCode 控制台输出中收到此错误。在模拟器上,一切正常。
这是我的简单完整代码:
import React, { Component } from 'react';
import { WebView } from 'react-native-webview';
const PolicyHTML = require('../assets/policy.html');
export default class PolicyScreen extends React.Component {
render() {
return (
<WebView
source={PolicyHTML}
style={{flex: 1}}
/>
);
}
}
在网上找不到太多解决方案,我错过了什么?
【问题讨论】:
-
您是否将此 HTML 文件作为资源/资产添加到您的 XCode 项目中?
-
没有。它仅在反应项目文件夹中
标签: reactjs xcode react-native uiwebview react-native-ios