Please download the attached sample project, which I am using to share a file.
While testing, I got a “Permission denied for the attachment” message when trying to share the txt file in Gmail app. Quick googling tells us this.
So then, a potential workaround could be to save the file to a path that does not raise the problem.
Have you tested how this behaves on iOS?