Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.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
Javascript Expo React Native Fetch API throw“;“网络请求失败”;将base64映像转换为blob时出错_Javascript_Reactjs_React Native_Expo - Fatal编程技术网

Javascript Expo React Native Fetch API throw“;“网络请求失败”;将base64映像转换为blob时出错

Javascript Expo React Native Fetch API throw“;“网络请求失败”;将base64映像转换为blob时出错,javascript,reactjs,react-native,expo,Javascript,Reactjs,React Native,Expo,我写了这段代码: export default (base64, type = 'application/octet-stream') => fetch(`data:${type};base64,${base64}`).then((res) => res.blob()); 为了将我的base64图像转换为blob 我的base64映像来自此函数: import * as ImagePicker from 'expo-image-picker'; const openIm

我写了这段代码:

export default (base64, type = 'application/octet-stream') =>
    fetch(`data:${type};base64,${base64}`).then((res) => res.blob());

为了将我的base64图像转换为blob

我的base64映像来自此函数:

import * as ImagePicker from 'expo-image-picker';

const openImagePickerAsync = async () => {
   ...
   const pickerResult = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: ImagePicker.MediaTypeOptions.All,
        base64: true
    });
   ...
}
该库返回了它从摄像机卷中抓取的base64图像, 所以我可以在我发送的第一个函数中使用它,使其变成一个blob

问题是,当我尝试从android real设备执行此操作时,此获取api抛出“网络请求失败”错误

建议?谢谢