9

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.

iPeter
  • 1,330
  • 10
  • 26
  • Have you solved this issue? I too am facing this problem. I know stopRecording is being called but the block never gets called. I tried calling stopRecording in various Dispatches but nothing helps. I wonder if this broke with iOS11. – John Riselvato Oct 10 '17 at 07:10
  • Nope. I am still stuck in this crap. :( @JohnRiselvato I wonder, but I have downloaded an app in iOS 11 beta, the app is called Housecraft. This works fine with the screen recording, please check once. – iPeter Oct 10 '17 at 07:37
  • Any news? I can't believe this error has not been fixed yet! – Sergio Viudes Oct 26 '17 at 19:54
  • Exactly! It is not fixed yet. :( – iPeter Oct 27 '17 at 07:40

2 Answers2

2

If you having this above issue with your code i have found the solution for this.

let sharedRecorder = RPScreenRecorder.shared()
sharedRecorder.stopRecording { previewViewController, error in 
if let error = error {
    self.showScreenRecordingAlert(message : error.localizedDescription)
    return
}}

Above Block will not call if you running your app on simulator so please use real device to test then above method will call definitely.

Thank you.

Hardik Vyas
  • 1,973
  • 1
  • 20
  • 43
1

Just had this issue running XCode 9.4.1 and building onto iOS 11.4.0. Upgrading the phone to iOS 11.4.1 fixed the bug. I'm not sure if the difference in XCode versions is the root cause or if 11.4.0 was just broken.

Laser
  • 5,085
  • 4
  • 34
  • 48