React native 在iOS上的Expo中保存PDF时,我收到一个错误
我正在使用react native和expo客户端进行开发。我有保存转换成PDF的html的代码。然后,我使用FileSystem.writeastringasync()方法将其保存到用户的手机上。这在Android上有效,但在iOS上产生以下错误:“未处理的承诺拒绝”。此文件类型尚不受支持'React native 在iOS上的Expo中保存PDF时,我收到一个错误,react-native,expo,react-native-ios,React Native,Expo,React Native Ios,我正在使用react native和expo客户端进行开发。我有保存转换成PDF的html的代码。然后,我使用FileSystem.writeastringasync()方法将其保存到用户的手机上。这在Android上有效,但在iOS上产生以下错误:“未处理的承诺拒绝”。此文件类型尚不受支持' let options = { html:html, base64:true, } const newPDF = await Print.printToFileAsync(opti
let options = {
html:html,
base64:true,
}
const newPDF = await Print.printToFileAsync(options);
const base64 = newPDF.uri;
var path = FileSystem.documentDirectory + 'App.pdf';
if(this.state.downloadType=='qr-codes'){
path = FileSystem.documentDirectory + 'QRCodes.pdf';
}else if(this.state.downloadType=='door-details'){
path = FileSystem.documentDirectory + 'DoorDetails.pdf';
}
await FileSystem.writeAsStringAsync(path, base64);
const asset = await MediaLibrary.createAssetAsync(path);
await MediaLibrary.createAlbumAsync("Download", asset, false);
alert("PDF Downloaded Successfully!");