我正在尝试删除我的应用程序中的本地文件。基本上,该应用程序会记录用户的音频,并通过两个选项“播放”和“删除”来显示它。
记录功能如下:
startRecord () {
if (this.platform.is ('ios')) {
this.fileName = 'Write';
this.filePath this.file.documentsDirectory.replace = (/ FILE: \ / \ // g ') + this.fileName;
this.audio = this.media.create (this.filePath);
} else if (this.platform.is ('android')) {
this.fileName = 'Write';
this.filePath this.file.externalDataDirectory.replace = (/ FILE: \ / \ // g ') + this.fileName;
this.audio = this.media.create (this.filePath);
}
this.audio.startRecord ();
this.recording = true;
}
删除功能如下:
deleteAudio () {
if (this.platform.is ('ios')) {
this.file.removeFile (this.file.documentsDirectory, this.fileName)
} else if (this.platform.is ('android')) {
this.file.removeFile (this.file.externalDataDirectory, this.fileName)
}
}
Logcat返回了我:DirectoryEntry.getFile的参数“ path”的类型错误:期望的字符串,但未定义。