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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to