【发布时间】:2023-12-18 05:15:01
【问题描述】:
我将本地文件存储在xcode中,文件在模拟器中加载但在ios设备中没有加载
我使用 react-native-webview 5.0.1 版,在我的 webview 中我将源传递为 {uri: 'ICF-Package/ICFPackage/index.html'}
<WebView
source={Platform.OS === 'ios' ?
{uri: 'ICF-Package/ICFPackage/index.html'} :
{ uri: 'file:///android_asset/ICF-Package/ICFPackage/index.html' }
}
ref={(webView) => this.webView = webView}
originWhitelist={'["*"]'}
javaScriptEnabled={true}
domStorageEnabled={true}
startInLoadingState={true}
useWebKit = {true}
//scalesPageToFit={true}
scrollEnabled={false}
onLoad={() => this.sendPostMessage()}
allowFileAccess={true}
allowUniversalAccessFromFileURLs={true}
allowFileAccessFromFileURLs={true}
allowsInlineMediaPlayback={true}
mediaPlaybackRequiresUserAction={true}
/>
我没有收到任何错误消息,但文件没有在真实设备中加载
【问题讨论】:
标签: react-native