执行5到6秒的网络操作时,UIAlertController操作因错误exc_bad_access崩溃

时间:2017-01-30 11:30:12

标签: swift

UIAlertController'在执行5到6秒的网络操作时,UIAction与错误exc_bad_access崩溃。操作成功执行但在最后一个UIAction括号上崩溃,并显示exc_bad_access错误。

@IBAction func AddSceneCollectionViewOnClick(_ sender:AnyObject){         createAlertViewAddScene()         present(uiAlertControllerAddScene,animated:true,completion:nil)

}

public func createAlertViewAddScene(){

    uiAlertControllerAddScene = UIAlertController(title: Constants.ALERT_VIEW_ADD_SCENE_TITLE,
                                                      message: Constants.ALERT_VIEW_ADD_SCENE_MESSAGE,
                                                      preferredStyle: .alert)


    let enterAction = UIAlertAction(title: Constants.ALERT_VIEW_ACTION_ENTER, style: .default, handler: {
        (action: UIAlertAction!) in


        let textField = self.uiAlertControllerAddScene.textFields?[0]
        print("textfield data is \(textField?.text)")

            Manager.getIntance().roommanager!.addSceneToRoom(scene: scene, roomId : roomId!)
    })




    let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: {
        (action: UIAlertAction!) in
    })


    uiAlertControllerAddScene.addTextField { (textField) in
        textField.placeholder = Constants.ALERT_VIEW_TEXT_FIELD_PLACE_HOLDER
    }


    uiAlertControllerAddScene.addAction(cancelAction)
    uiAlertControllerAddScene.addAction(enterAction)}


}

0 个答案:

没有答案