Instead of calling stop:, try CFRunLoopStop(CFRunLoopGetCurrent()). Should stop the innermost runloop call.


On Apr 17, 2008, at 12:16 AM, xiaobin wrote:

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.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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