How to call iOs file resource from custom script within app

Here is the situation:

We have a custom eReader that lives in our assets folder.
When we want to download an eBook from our server and read it, we download the file and save it using the Native File plugin.

When we start up the reader, we send it the container in which we want the reader to be created and built, and an internal url to the file resource we want to read.

After window.Ionic.WebView.convertFileSrc, the file ref looks like:

The reader will then build the iframe and send a simple XMHttpRequest to the provided url, then place the resulting html into the iframe.

The problem is that it only works on first load of the eBook from our server

I can see the file being downloaded, and written to its own folder in the apps file system (File.dataDirectory).
When I debug the XMLHttpRequest in our eReader.js, I can see the call being made to the resource and the HTML returning to the request, which is then rendered on the page.

BUT, if I close the app, reopen it, and try to access the already-downloaded book, the XMLHttpRequest in our eReader.js returns nothing.

I can verify that the file exists at the resource location after a reload, but the XMLHttpRequest acts like it cannot find anything at the provided location.

AND, this is only on iOs. Android works as intended.

My questions is, what am I missing? Is this something to do with the iOs permissions or persistence?

Any help would be appreciated.


As it turns out, in the above path name, the piece I have labeled as APP-ID changes for iOs on every build. And since we were saving the full path name as an absolute direction to the desired resource, a file saved on one instance of the app wouldn’t be available on subsequent loads of the app.

We solved this by storing the identifier to the file and then generating the path name to the file when we needed to access it.

Thanks to this article for the hint that helped me look in the right place.