• 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: synchronous or asynchronous connections?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection: synchronous or asynchronous connections?


  • Subject: Re: NSURLConnection: synchronous or asynchronous connections?
  • From: Nicko van Someren <email@hidden>
  • Date: Thu, 27 Jan 2005 11:46:36 +0000

On 27 Jan 2005, at 11:37, Toby Atkin-Wright wrote:

I'm writing an iPhoto plugin that uploads images to a web site, making a series of HTTP requests one after another. As I see it, I could either:

1/ Issue asynchronous requests, and keep track through delegate methods to update the progress bar, report errors, and trigger subsequent requests.

-or-

2/ Start a worker thread that issues synchronous requests one after another, while the main thread waits to hear from the worker and updates the progress bar etc. accordingly.


I can't decide which approach would be best - I can see pros and cons of each, but I don't know if one is 'obviously' the best way to work in Cocoa. (My code is currently working with asynchronous requests, but as I add more features, I keep thinking it may be easier with a separate thread.)

Use the asynchronous version. The complexity of managing the extra thread is at least as large as setting up a delegate and is painful if you want to cancel the request. Furthermore if you use the synchronous call on NSURLConnection you can't get progress information; you'll only know when the request completes or fails.


	Cheers,
		Nicko

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSURLConnection: synchronous or asynchronous connections? (From: Toby Atkin-Wright <email@hidden>)

  • Prev by Date: [newbie] Question about NSText
  • Next by Date: Re: [newbie] Question about NSText
  • Previous by thread: NSURLConnection: synchronous or asynchronous connections?
  • Next by thread: [newbie] Question about NSText
  • Index(es):
    • Date
    • Thread