                 
                 self?.task = nil
                 
-                dispatch_async(dispatch_get_main_queue(), { [weak self] () -> Void in
+                DispatchQueue.main.async(execute: { [weak self] () -> Void in
+                    guard let strongSelf = self else
+                    {
+                        return
+                    }
                     
-                    self?.activityIndicatorView.stopAnimating()
+                    strongSelf.activityIndicatorView.stopAnimating()
                     
                     if let error = error
                     {
-                        self?.presentVideoSettingsErrorAlert(error)
+                        strongSelf.presentVideoSettingsErrorAlert(error)
                     }
                     else
                     {
-                        NSNotificationCenter.defaultCenter().postNotificationName(VideoSettingsViewController.UploadInitiatedNotification, object: video)
+                        NotificationCenter.default.post(name: NSNotification.Name(rawValue: VideoSettingsViewController.UploadInitiatedNotification), object: video)
                         
-                        self?.dismissViewControllerAnimated(true, completion: nil)
-                    }
-                })            
+                        strongSelf.dismiss(animated: true, completion: nil)
+                    }
+                })
             })
             
             self.task?.resume()


    // MARK: Actions
    
    func didTapCancel(sender: UIBarButtonItem)
    {
        self.operation?.cancel()
        self.activityIndicatorView.stopAnimating()
        self.navigationController?.popViewControllerAnimated(true)
        
        if let videoUri = self.uploadTicket?.video?.uri
        {

        
        assert(self.input != nil, "self.input cannot be nil")
        
        self.edgesForExtendedLayout = UIRectEdge()
        
        self.setupNavigationBar()
        self.setupAndStartOperation()
