文件';(空)和#x27;isn';t可写异常(EXPO IOS)反应本机
我正在开发一个expo应用程序,在其中我生成二维码。我得到了base64字符串,可以在gallery/album中保存为jpg或png。到目前为止,在android上它工作正常。但在IOS上 它给出了这个错误 文件“(null)”不可写文件';(空)和#x27;isn';t可写异常(EXPO IOS)反应本机,ios,react-native,base64,filesystems,expo,Ios,React Native,Base64,Filesystems,Expo,我正在开发一个expo应用程序,在其中我生成二维码。我得到了base64字符串,可以在gallery/album中保存为jpg或png。到目前为止,在android上它工作正常。但在IOS上 它给出了这个错误 文件“(null)”不可写 node_modules/react native/Libraries/BatchedBridge/NativeModules.js:103:50 允诺 node_modules/@unimodules/react native adapter/build/N
- node_modules/react native/Libraries/BatchedBridge/NativeModules.js:103:50 允诺
- node_modules/@unimodules/react native adapter/build/NativeModulesProxy.native.js:15:23 在moduleName.methodInfo.name中
- node_modules/expo file system/build/FileSystem.js:50:17 in writeastringasync
const filename = FileSystem.documentDirectory + `${imageName}.jpg`;
let newFile = decodeURI(filename).replace('file://', '') ;
console.log(newFile)
FileSystem.writeAsStringAsync(filename, base64Code, {
encoding: FileSystem.EncodingType.Base64,
}).then(()=>{
console.log('worked')
}).catch((e)=>{
console.log(e)
});
await MediaLibrary.saveToLibraryAsync(filename).then(()=>{
setIsSavedGallery(true);
setTimeout(showAlertGallery, 1000);
}).catch((e)=>{
console.log(e)
});
关于这个错误有什么线索吗?我该怎么修理?我做错了什么?我似乎不明白。
任何形式的帮助都将不胜感激。
谢谢,我也有同样的问题。我的问题是文件名上有一个空格,这在iOS上不太合适,所以我用一个_