ReplayKit RPScreenRecorder fails to record didStopRecordingWith RPRecordingErrorDomain 5804

1.8k views Asked by At

I'm trying to record the screen with RPScreenRecorder from ReplayKit but it fails to start a recording. I get error code 5804. My code:

let recorder=RPScreenRecorder.shared()

func start_new_record(){
    guard recorder.isAvailable else{
        print("not available")
        return
    }
    recorder.delegate=self

    recorder.startRecording {error in
        guard error != nil else{
            print("error:", error ?? "")
            return
        }

        print("start recording handler")   // <- never called
    }
}

func screenRecorder(_ screenRecorder: RPScreenRecorder, didStopRecordingWith previewViewController: RPPreviewViewController?, error: Error?){
    print("didStopRecordingWith:", error ?? "")
}

I get this message:

didStopRecordingWith: Error Domain=com.apple.ReplayKit.RPRecordingErrorDomain Code=-5804 "Failed during recording" UserInfo={NSLocalizedDescription=Failed during recording}

Additional info: I tried this on an iPhone 7 and an iPhone 6 both on iOS 11. This is a separate project so there's nothing more here but the screen recording and a switch button on the UI to move when recording.


EDIT

This was probably a bug. I updated my iPhone with the latest version of iOS 11 and it seems to work now.

0

There are 0 answers