I am testing usability of a website and am using WKWebView in a native app. The reason for this is so that I can use COSTouchVisualizer to show the touches, and RPScreenRecorder to record the interaction and the 'talk out loud' with the mic.
I have the following IBAction to start the 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 the printing Successfully started recording.
However, when the button connected to the IBAction to stop recording is pressed the following code should run:
@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 out the first log ("1. before the recorder function"). I get non of the other log statements nor do the buttons toggle their enabled status.
I know the IBAction is connected due to hitting the statement but no idea why I can't get the stopRecordingWithHandler to fire.
I am testing this on an iPad Pro 9.7" running iOS 9.3.
I am starting to wonder if it has anything to do with trying to record a WKWebView but would imagine that I would get an error if this was the problem.
Any help would be greatly appreciated :)