Error handling in NSURLConnection sendAsynchronousRequest

Discussion in 'iOS Programming' started by waterskier2007, Mar 1, 2013.

  1. waterskier2007 macrumors 68000


    Jun 19, 2007
    Novi, MI
    I am using the asynchronous request of NSURL connection, but I want to pop up an alert if there is an error (by looking at the error in the completion handler). The problem is that I generate an exception. I believe this is because I am calling UIKit from a secondary thread.

    I was expecting this, so I set up a method on my view controller to present an alert and tried calling that method from within my completion handler using the [self performSelectorOnMainThread] but it still does not work.

    Does anyone have any idea how I may be able to remedy this?
  2. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State

Share This Page