react-native - TypeError:无法读取未定义的属性(读取“获取”)[react-native-ssl-pinning]
问题描述
我正在构建一个反应原生移动应用程序,我想使用react-native-ssl-pinning实现 SSL 固定。
我已经安装了所有必要的东西,我还导入了 fetch 方法:
import {fetch} from 'react-native-ssl-pinning';
这就是我调用 fetch 方法的方式:
fetch("https://xxx.xxx.xxx.xx/api/account/my_account/", {
method: "GET",
headers: {
Authorization: "Bearer " + token,
Accept: "application/json; charset=utf-8",
"Access-Control-Allow-Origin": "*",
e_platform: "mobile",
},
sslPinning: {
certs: ["mycert"],
},
})
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson);
})
.catch((error) => {
console.log(error);
});
运行应用程序后,我收到此错误:
有人有同样的问题吗,或者你有解决方案吗?
非常感谢。
解决方案
推荐阅读
- c# - 尝试使用 c# asp.net c# 使用 Google Cloud Vision 检测图像值
- c# - 如何序列化多个派生类的基类属性,ProtoBuf.net
- css - 即使在页面刷新或从应用程序注销后也禁用该按钮
- apache-spark - 使用 apache spark 统一不同的 JSON
- ios - Swift 4:值不能存储在 for-in 循环之外
- css - 查找宽度最大的元素的方法
- caching - 临时 Lucene 异常“字段“xyz”中的术语多于文档,但无法对标记化字段进行排序”
- python - 如果我们使用 Scikit-Learn 库的 RandomForestRegressor 有多个输出,如何计算拆分的杂质减少
- openvswitch - OpenFlow set_tunnel 使用 OVS 发送原始流量
- dynamics-crm - 自动导入作业动态 CRM 365