Error handling in NSURLConnection sendAsynchronousRequest

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

  1. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #1
    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

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State

Share This Page