0

Code=-5807 “Recording interrupted by multitasking and content resizing”

I have this code but I see all the time this euro if I reset my device or try with other device it is same error

I use ReplayKit but I can't record anymore

import UIKit import ReplayKit

class ViewController: UIViewController, RPPreviewViewControllerDelegate {

@IBOutlet var statusLabel: UILabel!
@IBOutlet var colorPicker: UISegmentedControl!
@IBOutlet var colorDisplay: UIView!
@IBOutlet var recordButton: UIButton!
@IBOutlet var micToggle: UISwitch!

let recorder = RPScreenRecorder.shared()
private var isRecording = false

override func viewDidLoad() {
    super.viewDidLoad()

    recordButton.layer.cornerRadius = 32.5
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}

func viewReset() {
    micToggle.isEnabled = true
    statusLabel.text = "Ready to Record"
    statusLabel.textColor = UIColor.black
    recordButton.backgroundColor = UIColor.green
}

@IBAction func colors(sender: UISegmentedControl) {
    switch sender.selectedSegmentIndex {
    case 0:
        colorDisplay.backgroundColor = UIColor.red
    case 1:
        colorDisplay.backgroundColor = UIColor.blue
    case 2:
        colorDisplay.backgroundColor = UIColor.orange
    case 3:
        colorDisplay.backgroundColor = UIColor.green
    default:
        colorDisplay.backgroundColor = UIColor.red
    }
}

@IBAction func recordButtonTapped() {
    if !isRecording {
        startRecording()
    } else {
        stopRecording()
    }
}

func startRecording() {

    func start() {

    guard recorder.isAvailable else {
        print("Recording is not available at this time.")
        return
    }

    if micToggle.isOn {
        recorder.isMicrophoneEnabled = true
    } else {
        recorder.isMicrophoneEnabled = false
    }

    recorder.startRecording{ [unowned self] (error) in

        guard error == nil else {
            print("There was an error starting the recording.")
            print("MyError:", error as Any)

            return
        }

        print("Started Recording Successfully")
        self.micToggle.isEnabled = false
        self.recordButton.backgroundColor = UIColor.red
        self.statusLabel.text = "Recording..."
        self.statusLabel.textColor = UIColor.red

        self.isRecording = true

    }
    }

    DispatchQueue.main.async {
        start()
    }

}

func stopRecording() {

   func stop() {

   recorder.stopRecording { [unowned self] (preview, error) in
        print("Stopped recording")

        guard preview != nil else {
            print("Preview controller is not available.")
            return
        }

        let alert = UIAlertController(title: "Recording Finished", message: "Would you like to edit or delete your recording?", preferredStyle: .alert)

        let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (action: UIAlertAction) in
            self.recorder.discardRecording(handler: { () -> Void in
                print("Recording suffessfully deleted.")
            })
        })

        let editAction = UIAlertAction(title: "Edit", style: .default, handler: { (action: UIAlertAction) -> Void in
            preview?.previewControllerDelegate = self
            self.present(preview!, animated: true, completion: nil)
        })

        alert.addAction(editAction)
        alert.addAction(deleteAction)
        self.present(alert, animated: true, completion: nil)

        self.isRecording = false

        self.viewReset()

    }
    }

    DispatchQueue.main.async {
        stop()
    }

}

I received each time this error after rest Device with iPhone XS Max or Other iPhone Model

Domain=com.apple.ReplayKit.RPRecordingErrorDomain Code=-5807 "Recording interrupted by multitasking and content resizing" UserInfo={NSLocalizedDescription=Recording interrupted by multitasking and content resizing})

M Reza
  • 18,350
  • 14
  • 66
  • 71
MidDev
  • 182
  • 1
  • 15

1 Answers1

0

I ran into the same issue, my device was even completely unable to record the screen again.

Update device to iOS 13.1.3 fixed everything.

Adrien Yvon
  • 662
  • 7
  • 18