'Replaykit - Recording not starting Error- 5803

I want to start recording in my App, I am using ReplayKit

func startRecordn(){
        recorder.startRecording{ [unowned self] (error) in
            //2
            guard error == nil else {
                print("There was an error starting the recording.")
                return
            }

            //3
            print("Started Recording Successfully")
        }
    }

Every time, I get the error

Domain=com.apple.ReplayKit.RPRecordingErrorDomain Code=-5803 "Recording failed to start" UserInfo={NSLocalizedDescription=Recording failed to start} There was an error starting the recording.



Solution 1:[1]

Finally found the issue, in my AppDelegate, below code created issue, I commented it and got the permission prompt

    if #available(iOS 13, *) {
        window = UIWindow(frame: UIScreen.main.bounds)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 allabtcoding