Closed djireland closed 2 months ago
I have same issue
I'm having the same issue for any kind of file on iOS, not just pdf.
Android also opens this dialog to choose with what program to open and after selection and then the files are opened as expected.
If you are using a simulator, try it on a real machine
If you are using a simulator, try it on a real machine
Oh no, we check it on different real IOS devices, this problem is not in simulator.
I've tried it and it works, Make sure your PDF files are in the app's sandbox, Maybe that's the reason
I have the same issue.
I found out the issue happens when the file extension is not '.pdf' even if Uti and Type are set.
I can reproduce the issue by using the flutter_cache_manager library that add a .file extension by default.
Hope it helps.
The (ugly) workaround I found for the old ".file" files still in cache looks like:
String path = file.path;
if (path.endsWith('.file')) {
final copied = await file.copy(
path.replaceFirst(RegExp(r'\.file$'), '.pdf'),
);
path = copied.path;
}
await OpenFile.open(
path,
type: 'application/pdf',
uti: 'com.adobe.pdf',
);
I'm trying to open a PDF file that is local to the device on IOS 12. The PDF doesn't open but rather an action dialog box opens (attached) instead. Can we open the PDF directly ?
Here is the code I'm using:
and pubspec.yaml
Thanks!