I implemented a simple UIActivityViewController as below
let activityController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
activityController.completionWithItemsHandler = { activityType, completed, returnedItems, activityError in
if let error = activityError where !completed && activityType != nil {
// report the error
}
}
I thought the Add Account screen for Mail could be handled automatically by the UIActivityViewController instance if the user have no mail accounts, but not, it's not doing it.
The first thing I tried was to analyze the completion closure: the activityError instance is nil and the completed value is false. Great, I put this workaround (i want to open from my aap. "settings >> mail >> add account " (the add account page) is it possible.?) whenever this closure with those values is called. But it's called also when the user press Cancel on the mail composer.
So, how do Photos and other not-Apple apps they handle this scenario? Thanks