An iOS share sheet can open successfully and still fail to share the file.
I hit this while testing an export flow this week.
The app created a temporary file. The share sheet appeared normally. The receiving app started importing it—and then the file disappeared before the read finished.
Nothing was wrong with the share sheet. The file lifetime was wrong.
My first implementation created the export too close to presentation, so the object keeping it alive could disappear while another app was still reading.
The corrected flow is:
Prepare the export
Retain its URL in state
Present the share sheet
Let the receiving app finish
Remove the file after dismissal
This is an easy bug to miss because the UI works. You tap Share, the system sheet opens, and everything looks finished.
But presenting the destination is not the same as completing the transfer.
Temporary files should live for the whole operation, not merely long enough to start it.
A useful reminder from shipping: when a system API hands work to another process, your resource lifetime must follow the consumer—not your own screen.
That is a nasty failure mode — everything looks right until the receiving app's read races the temp file disappearing. Your corrected flow is the part worth remembering: the file has to live for the whole operation, not merely long enough to start it.
commentslikes