I am trying to use the UIActivityViewControllerCompletionHandler
, but i dont quite get how..
I want to detect when the user finishes or dismisses this
For Swift, this one works for me...
// Configure UIActivityViewController let activityViewController = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil) activityViewController.excludedActivityTypes = [UIActivityTypeAirDrop, UIActivityTypeAddToReadingList, UIActivityTypeAssignToContact, UIActivityTypePrint, UIActivityTypeCopyToPasteboard] // Show UIActivityViewController presentViewController(activityViewController, animated: true, completion: nil) // Define completion handler activityViewController.completionWithItemsHandler = doneSharingHandler ... func doneSharingHandler(activityType: String!, completed: Bool, returnedItems: [AnyObject]!, error: NSError!) { // Return if cancelled if (!completed) { return } // If here, log which activity occurred println("Shared video activity: \(activityType)") }