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

how to wait the finish of NSURLDownload


  • Subject: how to wait the finish of NSURLDownload
  • From: xiaobin <email@hidden>
  • Date: Thu, 17 Apr 2008 15:16:20 +0900

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

[downloadFile setDestination:downloadPath allowOverwrite:YES];

[[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow: 2 ]];

it works correctly.
But I think it is too long time for the users who will use my
application. and I can change 2 seconds to 0.5 seconds, but how to do
if my server file is too large to download in 0.5 seconds.

and if I use

[[NSRunLoop currentRunLoop] run];

and use NSURLDownload delegate method, the following, to stop the
loop, it can not work well.

- (void)downloadDidFinish:(NSURLDownload *)download
{
	//....
	NSApplication *app = [NSApplication sharedApplication];
	[app stop:self];
}
using the stop method, It looks like to stop my whole application.

I have the problem for many days. I found the sample ImageClient in
apple web site.
http://developer.apple.com/samplecode/Cocoa/idxNetworking-date.html

It uses CFNetwork, but it also looks use several seconds to wait until
the download finish. I want to finish the download  automatically when
the  download finished.
anyone can help me?

thank you

--
xiaobin
_______________________________________________

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

  • Follow-Ups:
    • Re: how to wait the finish of NSURLDownload
      • From: "Sherm Pendley" <email@hidden>
    • Re: how to wait the finish of NSURLDownload
      • From: Ken Thomases <email@hidden>
    • Re: how to wait the finish of NSURLDownload
      • From: Michael Vannorsdel <email@hidden>
  • Prev by Date: Re: NSArrayController bound to @unionOfArrays not updating
  • Next by Date: Re: how to wait the finish of NSURLDownload
  • Previous by thread: Re: 1-bit NSBitmapImageRep?
  • Next by thread: Re: how to wait the finish of NSURLDownload
  • Index(es):
    • Date
    • Thread