I have searched enough but failed to get a solution.
I am using ReplayKit to record the screen of my app. I have started recording the screen by calling
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.startRecording() { error in 
    if let error = error {
        self.showScreenRecordingAlert(message: error.localizedDescription)
    }
}
When I am pressing the stopRecord button I am calling 
let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in 
    if let error = error {
        self.showScreenRecordingAlert(message : error.localizedDescription)
        return
    }
}
But the issue that I am facing is, the program control does not enter inside the stopRecording block. 
When I am doing po sharedRecorder.isRecording, it always returns false.
I have done everything I know but failed to get a solution.