0

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

Community
  • 1
  • 1
Luca D'Alberti
  • 4,749
  • 3
  • 25
  • 45

1 Answers1

0

Seems like Apple doesn't handle well a NSURL type in the activityItems. I solved it by using absoluteString value of that instance.

Luca D'Alberti
  • 4,749
  • 3
  • 25
  • 45