How to implement UIAlertController in tvOS

380 views Asked by At

I am implementing the UIAlertController in tvOS platform. It's working fine but when i am tap on the button action then the action is not call. But when move up and down with two button and tap any one the action calls.

Here is my code.

func showAlertMessage() {

        let alertController = UIAlertController(title: kAlertMessage, message: "", preferredStyle: UIAlertControllerStyle.Alert)
        let cancelButton = UIAlertAction(title: kCancelButton, style: UIAlertActionStyle.Default) { (action) -> Void in

            self.dismissView()
        }
        let retryButton = UIAlertAction(title: kRetryButton, style: UIAlertActionStyle.Default) { (action) -> Void in

            if self.playerObj != nil{

                if self.controlFlag == false {

                    self.playerItem?.removeObserver(self, forKeyPath: "status")
                }else{

                    self.playerItem?.removeObserver(self, forKeyPath: "status")
                }
                self.playerObj = nil
                self.playerItem = nil
                self.asset = nil
            }
             self.parseJSON()
        }

        alertController.addAction(retryButton)
        alertController.addAction(cancelButton)
        if self.alertMessageFlag != true {
            dispatch_async(dispatch_get_main_queue()) { () -> Void in

                self.presentViewController(alertController, animated: true, completion: nil)
            }
        }
    }  

please find out the issue and suggest me. thank you.

0

There are 0 answers