@danielle113 wrote:
Hi all,
I have code as below.
If
this.file.readAsArrayBufferinhasFile()cannot resolve a file, an err is caught successfully. This is as what I expect.however, if the file is resolved in
hasFile(), there is a chance thatconsole.log('then: ' + values);does not call. It means by random chances (like 50%) inionic run androidin my real android tablet, theconsole.log('then: ' + values);will not print out anything.Why is this, really does not make sense for me.
process() { Promise.all([this.hasFile(1)]).then(values => { console.log('then: ' + values); }).catch(err => console.log('err: ' + err)); } hasFile(i: number): Promise<ArrayBuffer> { console.log('in: ' + i); let fileName: string = i + this.suffix; return this.file.readAsArrayBuffer(this.file.externalDataDirectory, fileName); }
Posts: 1
Participants: 1