尝试同步记录时未显示swift UIAlertController

时间:2018-09-11 15:25:19

标签: swift file recording

我想起来真的很简单。...我想记录一个由AlertControllers控制的文件。请参见下面的代码。问题是警报未显示。尝试使用调度到主队列等...

好新的编辑行为相同,但是完成处理程序正在执行。我确实删除了信号量,希望不需要它。

       func record_file(file:String, start_title: String, start_message: String, stop_title: String, stop_message: String, cancel:Bool=false, sender:Any)
{
    //let semaphore = DispatchSemaphore(value: 0)
    let rec1_alert = UIAlertController(title: stop_title, message: stop_message, preferredStyle: UIAlertControllerStyle.alert)
    let stop_rec1_alert = UIAlertController(title: stop_title, message: stop_message, preferredStyle: UIAlertControllerStyle.alert)
    let stop_rec1_action =  UIAlertAction(title: stop_title, style: .default, handler: nil)


    let action = UIAlertAction(title: start_title, style: .default, handler:nil)



    rec1_alert.addAction(action)

    self.present(rec1_alert, animated: true, completion:
                        {
                        self.player.startRecording(filename:  (file as NSString).lastPathComponent as String)


                        stop_rec1_alert.addAction(stop_rec1_action)
                        self.present(stop_rec1_alert, animated: true, completion: {
                            self.player.finishRecording()
                            //semaphore.signal()

                    })

    })
}

0 个答案:

没有答案