I'm using ReplayKit to record the screen but when I run the app in the simulator I cant stop it and there is no preview of the recorded video but I'm getting following message in the output console.
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}
So I tried to run the app on the iPhone 6s itself.
I'm getting an alert about how to record in the app but when I tried to stop, it wont stop and there is a message in the console
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.
Also, when I press stop in the app, it won't change to start.
Here is the code:
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)
}
}
Where I am going/doing wrong?
Thanks.
P.S I just started iOS development so I can't completely understand what that message in the console is saying.