fixes a few memory leaks.
ARC is already starting to cripple my memory management code. Time to make the switch on AFNetworking.
This commit is contained in:
parent
2b2558a90e
commit
6f63157e33
1 changed files with 3 additions and 3 deletions
|
|
@ -60,7 +60,7 @@ typedef void (^AFURLConnectionProgressiveOperationProgressBlock)(NSInteger bytes
|
||||||
success:(void (^)(NSURLRequest *request, NSString *filePath))success
|
success:(void (^)(NSURLRequest *request, NSString *filePath))success
|
||||||
failure:(void (^)(NSURLRequest *request, NSError *error))failure
|
failure:(void (^)(NSURLRequest *request, NSError *error))failure
|
||||||
{
|
{
|
||||||
AFDownloadRequestOperation *requestOperation = [[self alloc] initWithRequest:urlRequest targetPath:(NSString *)targetPath shouldResume:shouldResume];
|
AFDownloadRequestOperation *requestOperation = [[[self alloc] initWithRequest:urlRequest targetPath:(NSString *)targetPath shouldResume:shouldResume] autorelease];
|
||||||
|
|
||||||
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
|
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
@ -87,8 +87,8 @@ typedef void (^AFURLConnectionProgressiveOperationProgressBlock)(NSInteger bytes
|
||||||
NSFileManager *fileMan = [[NSFileManager alloc] init];
|
NSFileManager *fileMan = [[NSFileManager alloc] init];
|
||||||
if(![fileMan createDirectoryAtPath:cacheFolder withIntermediateDirectories:YES attributes:nil error:&error]) {
|
if(![fileMan createDirectoryAtPath:cacheFolder withIntermediateDirectories:YES attributes:nil error:&error]) {
|
||||||
NSLog(@"Failed to create cache directory at %@", cacheFolder);
|
NSLog(@"Failed to create cache directory at %@", cacheFolder);
|
||||||
[fileMan release];
|
|
||||||
}
|
}
|
||||||
|
[fileMan release];
|
||||||
});
|
});
|
||||||
return cacheFolder;
|
return cacheFolder;
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +146,7 @@ typedef void (^AFURLConnectionProgressiveOperationProgressBlock)(NSInteger bytes
|
||||||
if (shouldResume) {
|
if (shouldResume) {
|
||||||
unsigned long long downloadedBytes = [self fileSizeForPath:tempPath];
|
unsigned long long downloadedBytes = [self fileSizeForPath:tempPath];
|
||||||
if (downloadedBytes > 0) {
|
if (downloadedBytes > 0) {
|
||||||
NSMutableURLRequest *mutableURLRequest = [urlRequest mutableCopy];
|
NSMutableURLRequest *mutableURLRequest = [[urlRequest mutableCopy] autorelease];
|
||||||
NSString *requestRange = [NSString stringWithFormat:@"bytes=%llu-", downloadedBytes];
|
NSString *requestRange = [NSString stringWithFormat:@"bytes=%llu-", downloadedBytes];
|
||||||
[mutableURLRequest setValue:requestRange forHTTPHeaderField:@"Range"];
|
[mutableURLRequest setValue:requestRange forHTTPHeaderField:@"Range"];
|
||||||
self.request = mutableURLRequest;
|
self.request = mutableURLRequest;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue