RPScreenRecorder startCapture未在后台录制

时间:2019-03-28 12:02:50

标签: ios swift replaykit

我正在尝试使用Replaykit实现ScreenRecording。它目前可以录制应用程序屏幕,但是当我将它放在后台进行设备屏幕录制时,则不会调用RPScreenRecorder.startCapture回调。

let recorder = RPScreenRecorder.shared()

recorder.delegate = self
recorder.startCapture(handler: { (buffer, bufferType, err) in
      self.counter = self.counter.advanced(by: 1)
      print(self.counter)
//    self.assetWriter.write(buffer: buffer, bufferType: bufferType)
   }, completionHandler: {
   if let error = $0 {
      print(error)
   }
 })

// stop recording

recorder.stopCapture {
   if let err = $0 {
       print(err)
   }
// self.assetWriter.finishWriting()
}

我们需要允许任何权限进行后台访问吗?

0 个答案:

没有答案