Fixes -[AFURLConnectionOperation totalBytesRead] threading issue.
This commit is contained in:
parent
cb3744a808
commit
580c547616
1 changed files with 7 additions and 7 deletions
|
|
@ -628,18 +628,18 @@ didReceiveResponse:(NSURLResponse *)response
|
||||||
- (void)connection:(NSURLConnection __unused *)connection
|
- (void)connection:(NSURLConnection __unused *)connection
|
||||||
didReceiveData:(NSData *)data
|
didReceiveData:(NSData *)data
|
||||||
{
|
{
|
||||||
self.totalBytesRead += [data length];
|
|
||||||
|
|
||||||
if ([self.outputStream hasSpaceAvailable]) {
|
if ([self.outputStream hasSpaceAvailable]) {
|
||||||
const uint8_t *dataBuffer = (uint8_t *) [data bytes];
|
const uint8_t *dataBuffer = (uint8_t *) [data bytes];
|
||||||
[self.outputStream write:&dataBuffer[0] maxLength:[data length]];
|
[self.outputStream write:&dataBuffer[0] maxLength:[data length]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.downloadProgress) {
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
self.totalBytesRead += [data length];
|
||||||
|
|
||||||
|
if (self.downloadProgress) {
|
||||||
self.downloadProgress([data length], self.totalBytesRead, self.response.expectedContentLength);
|
self.downloadProgress([data length], self.totalBytesRead, self.response.expectedContentLength);
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)connectionDidFinishLoading:(NSURLConnection __unused *)connection {
|
- (void)connectionDidFinishLoading:(NSURLConnection __unused *)connection {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue