Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 在react native中忽略Ssl证书验证操作_Android_Ssl_React Native_Ssl Certificate_Fetch - Fatal编程技术网

Android 在react native中忽略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

我正在开发一个应用程序,它使用rest api将其连接到数据库,并且我的服务器具有SSL证书,当我尝试发送请求时,它显示有一种方法可以在react native for android中禁用SSL验证


如果有人知道,请提供帮助。

此解决方案在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()
我想你可以参考一下可能的副本