0

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.

Marie Dm
  • 2,637
  • 3
  • 24
  • 43
  • Hi, why you said first time "you tried this on an iPhone 7 and an iPhone 6 both on iOS 11" then you edited your post and said "I updated my iPhone with the latest version of iOS 11 and it seems to work now". I'm confused. I tried with iOS 10.3 and I have the same issue as you, I can't figure it out – Ghiggz Pikkoro Jan 19 '18 at 14:11
  • Well maybe I was on iOS 11.0.1, then I updated to iOS 11.0.2 and the issue was gone. I don't know what to tell you more. I dropped this and don't use it anymore so I don't think I can help you, sorry. – Marie Dm Jan 19 '18 at 15:58

0 Answers0