title: RPScreenRecorder How recording screen audio and video of an app Action Extension?
body: <p>I would like to record the screen, audio, and video of my app with target <strong>Action Extension</strong>.</p>
  
  <p>If I put this code in a normal app, it works, but in an Action Extension doesn't.</p>
  
  <pre><code>@IBAction func recButton(_ sender: Any) {
  
  
          if recButton.currentTitle == "stop" {
              stopRecording()
              recButton.setTitle("rec", for: .normal)
          }
          else {
  
              recButton.setTitle("stop", for: .normal)
  
              RPScreenRecorder.shared().isMicrophoneEnabled = true
              RPScreenRecorder.shared().startRecording(handler: {[unowned self] (error) in
  
              //Handler - never called
              if let unwrappedError = error {
                  print(unwrappedError.localizedDescription)
              }
          })
          }
      }
  
      func stopRecording() {
          RPScreenRecorder.shared().stopRecording(handler: {(previewController, error) -&gt; Void in
  
              //Handler - never called
              if previewController != nil {
                  let alertController = UIAlertController(title: "Recording", message: "Do you want to discard or view your recording?", preferredStyle: .alert)
  
                  let discardAction = UIAlertAction(title: "Discard", style: .default) { (action: UIAlertAction) in
                      RPScreenRecorder.shared().discardRecording(handler: { () -&gt; Void in
                          // Executed once recording has successfully been discarded
                      })
                  }
  
                  let viewAction = UIAlertAction(title: "View", style: .default, handler: { (action: UIAlertAction) -&gt; Void in
                      self.present(previewController!, animated: true, completion: nil)
                  })
  
                  alertController.addAction(discardAction)
                  alertController.addAction(viewAction)
  
                  self.present(alertController, animated: true, completion: nil)
  
              } else {
                  // Handle error
              }
          })
      }
  </code></pre>
  
  <p>Is there another method to achieve this goal using AVCaptureSession, or do I need to use something else to achieve this? Thanks.</p>