Android 在react native中忽略Ssl证书验证操作
我正在开发一个应用程序,它使用rest api将其连接到数据库,并且我的服务器具有SSL证书,当我尝试发送请求时,它显示有一种方法可以在react native for android中禁用SSL验证Android 在react native中忽略Ssl证书验证操作,android,ssl,react-native,ssl-certificate,fetch,Android,Ssl,React Native,Ssl Certificate,Fetch,我正在开发一个应用程序,它使用rest api将其连接到数据库,并且我的服务器具有SSL证书,当我尝试发送请求时,它显示有一种方法可以在react native for android中禁用SSL验证 如果有人知道,请提供帮助。此解决方案在Android上对我有效: 安装包:npm安装--保存rn fetch blob 并将此代码粘贴到index.js中 import RNFetchBlob from 'rn-fetch-blob'; AppRegistry.registerComponent
如果有人知道,请提供帮助。此解决方案在Android上对我有效: 安装包:npm安装--保存rn fetch blob 并将此代码粘贴到index.js中
import RNFetchBlob from 'rn-fetch-blob';
AppRegistry.registerComponent(appName, () => App);
const Fetch = RNFetchBlob.polyfill.Fetch
// replace built-in fetch
window.fetch = new Fetch({
// enable this option so that the response data conversion handled automatically
auto : true,
// when receiving response data, the module will match its Content-Type header
// with strings in this array. If it contains any one of string in this array,
// the response body will be considered as binary data and the data will be stored
// in file system instead of in memory.
// By default, it only store response data to file system when Content-Type
// contains string `application/octet`.
binaryContentTypes : [
'image/',
'video/',
'audio/',
'foo/',
],
trusty : true
}).build()
我想你可以参考一下可能的副本