我正在使用 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)
}
}
我要去哪里/做错了什么?
谢谢。
PS 我刚开始 iOS 开发,所以我无法完全理解控制台中的消息在说什么。