jfoclpf opened a new issue, #1293:
URL: https://github.com/apache/cordova-ios/issues/1293
The files seem to load correctly from www folder when the app is run in
emulator, but not when run from the device (iPhone SE 1gen).
Any possible hint why this is happening?
I am reading like this
```js
readFile(cordova.file.applicationDirectory +
'www/json/anomalies.json').then((res) => {
const data = JSON.parse(res)
```
where `readFile` is
```js
export function readFile (path, options) {
options = options || {}
return new Promise(function (resolve, reject) {
window.resolveLocalFileSystemURL(path, (fileEntry) => {
fileEntry.file((file) => {
const reader = new FileReader()
reader.onloadend = () => {
resolve(reader.result)
}
const format = options.format
switch (format) {
case 'arrayBuffer':
reader.readAsArrayBuffer(file)
break
case 'binaryString':
reader.readAsBinaryString(file)
break
case 'dataURL':
reader.readAsDataURL(file)
break
default:
reader.readAsText(file)
}
reader.onerror = () => {
reject(Error(`Error occurred reading file: ${path}`))
}
})
}, (error) => {
reject(Error('resolve error', error))
})
})
}
```

Any help will be highly appreciated
Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]