const uri = await getFileInfo(fileName);
const body = new FormData();
body.append('file', {
uri,
name: 'helloworld',
type: 'image/jpeg'
});
// process current image
await axios.post(`${MEDIA_URL}/raw`, body, headers);
以上代码在IOS上运行良好,但在Android上,我得到以下信息:
java.lang.ClassCastException:uri的值不能从 ReadableNativeMap转换为字符串
没有明显的迹象表明它来自哪里,但是URI对象看起来像这样:
Object {
"exists": true,
"isDirectory": false,
"modificationTime": 1560600287,
"size": 2898352,
"uri": "file:///data/user/0/com.project.name/files/ExperienceData/%2540project%252Fproject-name/_64_4/838f7807-bb53-4017-bd5a-f8f506292ad3.jpg",
}
关于造成这种情况的任何迹象?