我正在使用ReplayKit来录制屏幕,但是当我在模拟器中运行该应用程序时,我无法停止它,并且无法预览录制的视频,但是我在输出控制台中收到了以下消息。
2016-07-27 23:46:35.196 replay1[65028:4134788] plugin com.apple.ReplayKit.RPVideoEditorExtension interrupted
2016-07-27 23:46:35.196 replay1[65028:4134989] Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.ReplayKit.RPVideoEditorExtension" UserInfo={NSDebugDescription=connection to service named com.apple.ReplayKit.RPVideoEditorExtension}
因此,我尝试在iPhone 6s本身上运行该应用程序。
我收到有关如何在应用程序中进行录制的警报,但是当我尝试停止时,它不会停止并且控制台中显示一条消息
2016-07-27 21:29:43.118 replay[3009:968481] -[UIWindow endDisablingInterfaceAutorotationAnimated:] called on <UIWindow: 0x14ce56570; frame = (0 0; 375 667); gestureRecognizers = <NSArray: 0x14ce573f0>; layer = <UIWindowLayer: 0x14ce55480>> without matching -beginDisablingInterfaceAutorotation. Ignoring.
另外,当我在应用程序中按
stop
时,它不会更改为start
。这是代码:
import ReplayKit
import UIKit
class ViewController: UIViewController, RPPreviewViewControllerDelegate
{
override func viewDidLoad()
{
super.viewDidLoad()
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Start", style: .Plain, target: self, action: #selector(startRecording))
}
func startRecording()
{
let recorder = RPScreenRecorder.sharedRecorder()
recorder.startRecordingWithMicrophoneEnabled(true) { [unowned self] (error) in
if let unwrappedError = error
{
print(unwrappedError.localizedDescription)
} else
{
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Stop", style: .Plain, target: self, action: #selector(self.stopRecording))
}
}
}
func stopRecording()
{
let recorder = RPScreenRecorder.sharedRecorder()
recorder.stopRecordingWithHandler { [unowned self] (preview, error) in
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Start", style: .Plain, target: self, action: #selector(self.startRecording))
if let unwrappedPreview = preview
{
unwrappedPreview.previewControllerDelegate = self
self.presentViewController(unwrappedPreview, animated: true, completion: nil)
}
}
}
func previewControllerDidFinish(previewController: RPPreviewViewController)
{
dismissViewControllerAnimated(true, completion: nil)
}
}
我要去哪里/做错了什么?
谢谢。
附注:我刚刚开始iOS开发,因此我无法完全理解控制台中的信息。
最佳答案
我从来没有能够让replayKit在模拟器中工作。我认为它依靠硬件中的物理芯片来完成某些工作。
我不确定您错误的自动旋转部分。