We are using the package receive_sharing_intent in our application, but with recent update of Flutter and the package not being updated for 15 months, the feature implemented does not work well now, especially on iOS, Android is still doing fine until now.
The feature: for every kind of document (PDF, txt, xls, ...) stored in the device or attached to a mail, when you share it with the application, it should open it, process it, and store it in our database. So we use the package here to retrieve external data and open our application, and that both on Android and iOS.
We still have not found a workaround that lasts over time for this specific case. Let me know if you find a solution while I continue my research.
Thanks in advance.
CodePudding user response:
I spent a few days on this error, finally I found the exact problem I was experiencing, and the solution.
I finally got the error for the .PDF file extension, the path is incorrect. There is a function in the SwiftReceiveSharingIntentPlugin.swift file inside the Flutter package receive_sharing_intent that is supposed to remove the substring "file://" at the beginning of the file path, but for some reason I still have it in my PDF file path, so it could never be found.
To solve this problem, I use the "replaceAll" method in my Flutter code:
file!.path.replaceAll("file://", "")
I updated the title of this post to match the problem I encountered.