i have a problem on IOS when i try to load a PDF File with inAppBrowser. With the same code, i don't have any problem to open the file on the Web
I call the InAppBrowser to open a PDF like this :
this.inAppBrowser.create(helpAsset.url, '_system', 'hideurlbar=yes');
helpAsset.url define a file which is in my asset/ repository, it's an internal file
When i build my app with xcode in debug and i put it on my Ipad (on IOS 12), the file open in Safari without problem. But with the same version but in release mode, the file don't open and i have a empty page
I tried to change '_system' in '_blank'but the problem is the same.
I have read that it can be a CORS problem which can be solve with the ionic-native http but i have no idea how to integrate it with the inappBrowser
Anyone know how to fix this?
Finally,
i bypass the problem by creating the PDF file on the Ipad, read it from it, and it's work (the PDF isn't open in safari but with the default IOS PDF reader plugin)
this.file.createDir(rep, 'edossier', true).then(
createDirReturn => {
this.file.createFile(rep + '/edossier', 'pdfToDisplay.pdf', true).then(
createFileReturn => {
this.httpClient.get(helpAsset.url, { responseType: 'blob' }).subscribe(result => {
this.file.writeExistingFile(rep + '/edossier', 'pdfToDisplay.pdf', result).then(
writingFileReturn => {
this.inAppBrowser.create(rep + '/edossier/' + 'pdfToDisplay.pdf', '_blank', 'hideurlbar=no,location=no,toolbarposition=top'
);
}
);
});
});
});
I think the code can be better, but this works fine.