- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过 fetch api 上传图片但得到 网络请求失败 真实设备android上的错误。
我也尝试了很多来自谷歌的建议,但对我没有任何帮助。
我的依赖是:
"react-native": "0.62.0",
"axios": "^0.19.2",
"form-data": "^3.0.0",
"react": "16.11.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
const imagePick = () => {
const formData = new FormData();
try {
const options = {
title: 'Select Avatar',
storageOptions: {
skipBackup: true,
path: 'images',
},
};
ImagePicker.showImagePicker(options, (response) => {
formData.append('avatar', {
uri: response.uri,
type: response.type,
name: response.fileName,
})
fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'multipart/form-data',
'Authorization': `Bearer ${authToken}`
},
body: formData
})
.then(res => {
console.log(res.status)
})
.catch(e => {
console.log(e)
})
});
} catch (e) {
toast("Unable to upload profile photo")
}
}
最佳答案
我也面临同样的问题,但我想这个问题与 axios 库无关,而是因为 React Native 本身。
如此处所述,comment ,是因为脚蹼 .
因此,在 React Native 对其进行处理之前,您可以在 MainApplication.java 中提到的下面的行中进行评论
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
发表评论 , 把//放在上面一行的前面
//initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
关于android - 网络请求失败在 https 图像上传 Android 上做出 native react ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61102893/
我创建了一个库项目,然后构建它,获取 .aar 并解压缩它。获取包含库的 classes.jar 文件,并将其添加到另一个项目中。该项目识别我的文件,我可以从中调用方法和函数。我的问题是我尝试从我的库
这不是现实世界的问题,我只是想了解如何创建 promise 。 我需要了解如何为不返回任何内容的函数做出 promise ,例如 setTimeout。 假设我有: function async(ca
我是 Promise 的新手。我写了两个例子: 第一个是: new RSVP.Promise(function (resolve, reject) { setTimeout(function
我有一个 nodejs (express) 作为服务器端,一个 angular 6 作为客户端。在服务器中我有中间件功能,可以进行 session 检查。如果 session 无效或不存在,我想向客户
我有一个 nodejs (express) 作为服务器端,一个 angular 6 作为客户端。在服务器中我有中间件功能,可以进行 session 检查。如果 session 无效或不存在,我想向客户
我有四个 I/O 操作:A、B、C 和 D。它们中的每一个都应该使用 vertx.executeBlocking 来执行。我应该有以下行为: //PSEUDOCODE waitForExecuteBl
我是一名优秀的程序员,十分优秀!