Alert Controller Freezes on main thread
<p>Am connecting to the services and receiving the data from backend. The code is as follows: </p>

<pre><code> _ = session.dataTaskWithRequest(request, completionHandler: { (data, response, error) in

        if response != nil{

           var responseREcvd = response as? NSHTTPURLResponse
            if responseREcvd?.statusCode == 404 {
                let  alertControler = UIAlertController(title: "404", message: "Server Down.", preferredStyle: .Alert)
                let alertAction = UIAlertAction(title: "OK", style: .Default, handler: nil)
                alertControler.addAction(alertAction)
                dispatch_async(dispatch_get_main_queue(), {
                    targetVC.presentViewController(alertControler, animated: true, completion: nil)
                })
            }
        }
</code></pre>

<p>The alert is displayed but it freezes the UI. When I press the OK action button, no action is invoked. </p>