• 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: how to wait the finish of NSURLDownload
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to wait the finish of NSURLDownload


  • Subject: Re: how to wait the finish of NSURLDownload
  • From: "Sherm Pendley" <email@hidden>
  • Date: Thu, 17 Apr 2008 10:50:24 -0400

On Thu, Apr 17, 2008 at 2:16 AM, xiaobin <email@hidden> wrote:

> hi, all
>
> In my application, I want to download a file from internet. so I use
> NSURLDownload to do it. and using NSRunLoop to wait until finish the
> downloading action. for example 2 seconds. codes as the following


By managing your own runloop, you're making this way harder than it needs to
be. Just open a sheet (or modal panel) with a progress bar, which has its
own runloop. Then make your controller the NSURLDownload object's delegate,
and create a delegate method downloadDidFinish: that closes the sheet/panel.
You can also respond to download:didReceiveDataOfLength: to accurately
update the progress bar.

Delegate methods are key to asynch I/O in Cocoa - it's worthwhile to learn
how to use them.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

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: 
 >how to wait the finish of NSURLDownload (From: xiaobin <email@hidden>)

  • Prev by Date: to make NSOutlineView faster
  • Next by Date: Re: Vended Object Setters
  • Previous by thread: Re: how to wait the finish of NSURLDownload
  • Next by thread: Menu validation problem with Font Manager menu items
  • Index(es):
    • Date
    • Thread