• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSURLConnection sync vs async connections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection sync vs async connections


  • Subject: Re: NSURLConnection sync vs async connections
  • From: Jerry Krinock <email@hidden>
  • Date: Thu, 23 Sep 2010 07:21:07 -0700

On 2010 Sep 23, at 02:21, Devraj Mukherjee wrote:

> Previous version I used NSURLConnection to make synchronous calls to
> the API, parsing the data and then returning results.  Only problem of
> course is that my API client had to be used in threads so the UI
> didn't get locked up while the request was being made.

There are also the ill-defined errors that you get from sendSynchronousRequest:returningResponse:error:, which make it difficult to present appropriate error recovery.

> I would like to move towards using async requests.

Good idea.

> I can grab / parse
> the data using the delegate methods, what I am struggling with is how
> I return the data to the application incorporating my library?
>
> Notifications? Or take define a protocol that the application has to
> implement and call back appropriate messages?

On 2010 Sep 23, at 05:37, Ken Thomases wrote:

> You could follow the example of the class you're using.  NSURLConnection uses the delegate pattern.

Indeed, there is the simple approach of having your data-consumer object create and own an NSURLConnection when needed, making itself the connection's delegate.

Notifications, delegates, protocols will all work.  The best approach may depend on other considerations in your app.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSURLConnection sync vs async connections (From: Devraj Mukherjee <email@hidden>)
 >Re: NSURLConnection sync vs async connections (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: [ANN] Release: NanoStore 1.0 for Mac and iOS
  • Next by Date: cool way to call super?
  • Previous by thread: Re: NSURLConnection sync vs async connections
  • Next by thread: CGDisplayChangeSummaryFlags
  • Index(es):
    • Date
    • Thread