ytakzk/UNAlertView

Failing Alert

Closed this issue · 2 comments

hello
when i in insert alert to my project but not running.
can you help me ??


        NSURLSession.sharedSession().dataTaskWithURL(url){ [unowned self] (data , repsonse , error) in
            if error != nil {
                print(error!)
                let alertView = UNAlertView(title: "hello", message: "link failing ")

                alertView.addButton("Done", action: {
                     self.navigationController?.popViewControllerAnimated(true)

                })


                // Show
                alertView.show()





            } else {

@J-Phantom I know the reason why you cannot run the code. Let me update some codes in a few days.

@J-Arji You have to wrap it to run in the main thread. Can you try that?

dispatch_sync(dispatch_get_main_queue(), {

                let alertView = UNAlertView(title: "hello", message: "link failing ")

                alertView.addButton("Done", action: {
                     self.navigationController?.popViewControllerAnimated(true)

                })


                // Show
                alertView.show()

});