I'm working on an action extension for an app which prepares some data for the user and then uses MailCore2 to send this information to a SMTP server. Preparing data is done very fast, but sending the email might take some time (depending on its size). That's why I'm looking for a way to handle the sending activities in the background. But this results in some problems with different solutions:
Using URLSession. This is the first way to go for handling big uploads or downloads in an iOS extension. But the problem is that MailCore2 does not use URLSessions to transmit the data to the mail server. So this is not usable. Or is it possible to somehow 'wrap' this call in an URLSession?
Using UNUserNotificationCenter and send a local notification from the extension after data preparation. The idea is to start the sending task in the main app after receiving this notification. Problem: the notifications
userNotificationCenter didReceive
method is only called, when the user clicks the notification. A simple badge notification does not call the delegate method.Using Background Fetch. This is working fine in the simulator, but on an iOS device there is an error when connecting to the SMTP server. I came across the same HELO problem as described in github.com/MailCore/mailcore2/issues/252. For this issue, a solution should be
MCOSMTPSession.isUseHeloIPEnabled = true
, but this might not work for all servers. So also not a perfect solution.
Any ideas, how to handle such a task? Or how to deal with one of the solutions mentioned above?
Edit: as this question does not receive any answers yet: what is unclear or which additional information is required?