Fix double call to NSURLConnection start + wrong condition for low priority (fix #212)

This commit is contained in:
Olivier Poitrey 2012-11-06 09:17:44 +01:00
parent ed690465d8
commit bf1b946b9a
1 changed files with 3 additions and 4 deletions

View File

@ -56,16 +56,15 @@
dispatch_async(dispatch_get_main_queue(), ^
{
self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO];
[self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
[self.connection start];
self.executing = YES;
self.connection = [NSURLConnection.alloc initWithRequest:self.request delegate:self startImmediately:NO];
// If not in low priority mode, ensure we aren't blocked by UI manipulations (default runloop mode for NSURLConnection is NSEventTrackingRunLoopMode)
if (self.options & SDWebImageDownloaderLowPriority)
if (!(self.options & SDWebImageDownloaderLowPriority))
{
[self.connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
}
[self.connection start];
if (self.connection)