var recorder : Recorder? = nil
func startAudioRecording() {
if recorder == nil {
recorder = Recorder()
}
if !recorder!.isRunning() {
recorder?.startRecording({ [weak self] audioData in
self?.remoteInterface?.sendVoice(audioData.0)
}, withCompletionBlock: { (_) in })
}
}
func stopAudioRecording(_ keyCommand: String!){
if let _ = recorder {
if(recorder?.isRunning())! {
recorder?.stopRecording(completionBlock: { (isFinished: Bool) in
DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + Double(Int64(1 * NSEC_PER_MSEC)) / Double(NSEC_PER_SEC), execute: { [unowned self] in
self.remoteInterface?.sendTouchUp(keyCommand)
self.audioRecorder = nil
})
})
}
}
}
我们如何消除强制展开?