Это было ответино довольно давно, но есть смесь отсутствующей и не быстрой информации, поэтому вот моя версия в надежде, что она поможет кому-то, кому нужен более полный пример обработчика завершения:
avc.completionWithItemsHandler = {[weak self](activityTypeChosen, completed:Bool, returnedItems:[AnyObject]?, error:NSError?) -> Void in
// ReturnedItems is an array of modified NSExtensionItem, or nil of nothing modified
// if (activityType == nil) User dismissed the view controller without making a selection.
// Dismiss the view controller we presented
// (assume a reference to it was stored in self.activityVC)
self?.activityVC?.dismissViewControllerAnimated(true, completion: {
if activityTypeChosen == nil {
NSLog("User canceled without choosing anything")
}
else if completed {
NSLog(")User chose an activity and iOS sent it to that other app/service/whatever OK")
}
else {
NSLog("There was an error: \(error)")
}
})
}
Обратите внимание на строку, в которой он отклоняет контроллер вида. Документы для UIActivityViewController очень четко говорят о том, что ваше приложение несет ответственность за то, что они отображают VC и , отклоняя его.