This repository contains a sample Xcode project demonstrating an issues with receiving email message files (*.eml
) from Apple Mail using a NSFilePromiseReceiver
.
There is an example of a workaround to this issue in the workaround branch that uses file system events to catch the eMail being dropped onto the app.
The code in this repo is purposely written in a way that closely follows Apple's own sample code so that any possible implementation errors on my end are kept to an absolute minimum.
The app in this project displays a view (DropView
& DropViewController
) that is configured to accept .eml
email files via drag and drop file promises.
When an appropriate file is dropped onto said view, the app should resolve the file promise(s) by having them written to a temporary directory. Once that's done, a simple message should be print()
-ed to the console, displaying the temporary location the promised file has been written to.
When receiving drag and drop file promises from Apple's Mail.app, this does not seem to work as expected.
The file promise is resolved and the files are written to the requested temporary location, however, when resolving the promise the application hangs for fairly exactly 60 seconds and then passes an error to the callback block of NSFilePromiseReceiver.receivePromisedFiles
that reads as follows:
Error Domain=NSURLErrorDomain Code=-1001 "(null)"
I've attempted to use other apps that can use file promises to drag and drop email messages (e.g. Microsoft Outlook) with the code in this project and those attempts seem to work without issue. I'm only able to reproduce this issue with Apple Mail (running macOS Catalina, though I have not yet been able to test other versions of macOS).
It appears as though some code that's generating the NSURL
for the NSFilePromiseReceiver.receivePromisedFiles
callback block is timing out, though I'm not yet sure why.
I have verified that the requested files are always placed in the desired location by the file promise providing app, even Apple Mail. It's just that with Apple Mail, the aforementioned NSURL
error makes using the files once placed in the requested location impossible because of the 60 second delay & the error, leaving the passed URL empty.