title: UIActivityViewController in iOS 10
body: <p>Anyone know how to use UIActivityView in iOS 10? Now that for some reason in Swift 3.0 it will compile and build but when the application is running after pressing a share button using the following code results in an application crash... it worked perfectly in iOS 9.3 and Swift 2.0.</p>
  
  <p>As specified in the comments of the code line 6 or <code>let objectsToShare = [textToShare] as! AnyObject</code> causes a Thread1: signal SIGABRT and application crash</p>
  
  <pre><code>@IBOutlet weak var detailDescriptionLabel: UITextView!
  
  @IBAction func share(_ sender: AnyObject) {
          let textToShare = detailDescriptionLabel.attributedText
  
          let objectsToShare = [textToShare] as! AnyObject
          // line above causes app crash in iOS 10 - compiled and built
          // error is "Thread1: signal SIGABRT"
  
          let activityVC = UIActivityViewController(activityItems: objectsToShare as! [AnyObject], applicationActivities: nil)
  
          activityVC.popoverPresentationController?.sourceView = (sender as! UIView)
          self.present(activityVC, animated: true, completion: nil)
      }
  
  
  class ActivityForNotesViewController: UIActivityViewController {
  
      internal func _shouldExcludeActivityType(_ activity: UIActivity) -&gt; Bool {
          let activityTypesToExclude = [
              //insert UIActivity here
          ]
  
          if let actType = activity.activityType {
              if activityTypesToExclude.contains(actType) {
                  return true
              }
              else if super.excludedActivityTypes != nil {
                  return super.excludedActivityTypes!.contains(actType)
              }
          }
          return false
      }
  }
  </code></pre>
  
  <p>Anyone that can help me I'd appreciate it. </p>