replaykit startrecording有时永远不会进入完成处理程序

sta*_*ley 5 ios swift replaykit

我使用的重放包保存在游戏过程中随机不过有时我的屏幕的视频startRecordingWithMicrophoneEnabled,并recorder.stopRecordingWithHandler不会进入完成处理

它不会抛出错误,它只会无限期地运行并挂起.

if recorder.available && recorder.microphoneEnabled {
    recorder.startRecordingWithMicrophoneEnabled(true) { [unowned self] (error) in
        if let unwrappedError = error {
            print(unwrappedError.localizedDescription)
        } else {
            print("called")
            self.manager.instructions.text = "Click to Start Game"
        }
    }
}

if recorder.available && recorder.microphoneEnabled {
    print("initiating stop recording")
    recorder.stopRecordingWithHandler { [unowned self] (RPPreviewViewController, error) in
        print("in completion handler")
        if let previewView = RPPreviewViewController {
            print("will transition to gameplay video")
            previewView.previewControllerDelegate = self
            self.presentViewController(previewView, animated: true, completion: nil)
            self.sessionHandler.session.stopRunning()
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Gua*_*eed 0

我也得到了同样的东西。正在一台设备上工作,而不是在另一台设备上工作。唯一的区别是工作设备的 iOS 版本为 10.1.0,而另一个设备的 iOS 版本为 10.0.2 - 升级到 10.2.0 并且立即开始工作。