I am testing website usability and using WKWebView in my native application. The reason for this is that I can use the COSTouchVisualizer to show strokes, and RPScreenRecorder to record the interaction and loud conversation with the microphone.
I have the following IBAction to start recording:
@IBAction func startRecordSession(sender: AnyObject) { let recorder = RPScreenRecorder.sharedRecorder() guard recorder.available else{ print("Cannot record the screen") return } recorder.delegate = self recorder.startRecordingWithMicrophoneEnabled(true) { (err) in guard err == nil else{ if err!.code == RPRecordingErrorCode.UserDeclined.rawValue{ print("User declined app recording") } else if err!.code == RPRecordingErrorCode.InsufficientStorage.rawValue{ print("Not enough storage to start recording") } else{ print("Error happened = \(err!)") } return } print("Successfully started recording") self.recordBtn.enabled = false self.stopRecordBtn.enabled = true } }
Which seems to work with printing. Successfully started recording.
However, when the button connected to IBAction is pressed to stop recording, the following code should work:
@IBAction func stop() { let recorder = RPScreenRecorder.sharedRecorder() print("1. before the recorder function")// This prints recorder.stopRecordingWithHandler{controller, err in guard let previewController = controller where err == nil else { self.recordBtn.enabled = true self.stopRecordBtn.enabled = false print("2. Failed to stop recording")// This does not prints return } previewController.previewControllerDelegate = self self.presentViewController(previewController, animated: true, completion: nil) } }
But nothing happens except to print the first magazine ("1. in front of the recorder function"). I get no other log entries, and the buttons do not switch their activated status.
I know that IBAction is connected due to a hit statement, but I don't know why I cannot start stopRecordingWithHandler.
I am testing this on an iPad Pro 9.7 "running iOS 9.3.
I'm starting to wonder if it has anything to do with trying to write a WKWebView, but imagine that I get an error if this is a problem.
Any help would be greatly appreciated :)
source share