I am using replay kit to save a video of my screen during gameplay but randomly on occasion startRecordingWithMicrophoneEnabled
and recorder.stopRecordingWithHandler
never enters the completion handler
我正在使用重放工具包在游戏过程中保存我的屏幕视频,但随机偶尔startRecordingWithMicrophoneEnabled和recorder.stopRecordingWithHandler永远不会进入完成处理程序
it doesn't throw an error, it just runs and hangs indefinitely.
它不会抛出错误,只是运行并无限期挂起。
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()
}
}
}
2 个解决方案
#1
0
I was getting this same thing. Was working on one device, and not on another. Only difference was the working device was on iOS version 10.1.0 and the other was iOS version 10.0.2 - upgraded to 10.2.0 and it started working immediately.
我得到了同样的东西。正在使用一台设备,而不是另一台设备。唯一不同的是工作设备在iOS版本10.1.0上,另一个是iOS版本10.0.2 - 升级到10.2.0并且它立即开始工作。
#2
0
I had the same problem and just found its cause (or maybe just a cause). If your device is connected to a WiFi that has no internet access this problem occurs. If you connect it to a WiFi that has internet access or disable WiFi it works just fine. I guess when starting a recording, ReplayKit tries to connect to some Apple servers but never reaches them and also never times out. You can observe the same behavior with the App Store. When you are connected to a WiFi without internet it tries to load the store forever and never times out.
我有同样的问题,只是找到了原因(或者只是一个原因)。如果您的设备连接到无法访问互联网的WiFi,则会出现此问题。如果您将其连接到具有互联网接入或禁用WiFi的WiFi,它可以正常工作。我想在开始录制时,ReplayKit尝试连接到某些Apple服务器,但从未到达它们,也永远不会超时。您可以在App Store中观察到相同的行为。当您连接到没有互联网的WiFi时,它会尝试永久加载商店,永远不会超时。
#1
0
I was getting this same thing. Was working on one device, and not on another. Only difference was the working device was on iOS version 10.1.0 and the other was iOS version 10.0.2 - upgraded to 10.2.0 and it started working immediately.
我得到了同样的东西。正在使用一台设备,而不是另一台设备。唯一不同的是工作设备在iOS版本10.1.0上,另一个是iOS版本10.0.2 - 升级到10.2.0并且它立即开始工作。
#2
0
I had the same problem and just found its cause (or maybe just a cause). If your device is connected to a WiFi that has no internet access this problem occurs. If you connect it to a WiFi that has internet access or disable WiFi it works just fine. I guess when starting a recording, ReplayKit tries to connect to some Apple servers but never reaches them and also never times out. You can observe the same behavior with the App Store. When you are connected to a WiFi without internet it tries to load the store forever and never times out.
我有同样的问题,只是找到了原因(或者只是一个原因)。如果您的设备连接到无法访问互联网的WiFi,则会出现此问题。如果您将其连接到具有互联网接入或禁用WiFi的WiFi,它可以正常工作。我想在开始录制时,ReplayKit尝试连接到某些Apple服务器,但从未到达它们,也永远不会超时。您可以在App Store中观察到相同的行为。当您连接到没有互联网的WiFi时,它会尝试永久加载商店,永远不会超时。