这是我的代码:我创建了一个 flex 移动应用程序,我想在其中将 pdf 格式的文件保存在 ipad/iphone(任何 IOS 设备)中,但在保存该文件时,它会出现 #2038 错误。这是我的代码。
var file:File = File.desktopDirectory.resolvePath("indicators.pdf");
if (file.exists)
file.deleteFile(); //delete it if exists
//create a file stream to be able to write the content of the file
var fileStream:FileStream = new FileStream();
var popUpPage:AlertPage = new AlertPage();
try
{
//open the file stream and set for Write
fileStream.open(file, FileMode.WRITE);
//writes the bytes
fileStream.writeBytes(pdfBytes, 0, pdfBytes.length);
//close the stream
fileStream.close();
PopUpManager.addPopUp(popUpPage,this,true);
popUpPage.lblAlert.text = "indicator saved in pdf format = "+ file.nativePath;
PopUpManager.centerPopUp(popUpPage);
this.visible = false;
}
catch(err :Error)
{
PopUpManager.addPopUp(popUpPage,this,true);
popUpPage.lblAlert.text = err.message + " "+ file.nativePath;
PopUpManager.centerPopUp(popUpPage);
}