From 1cfa4059577e173488457fc5eec95098115fda13 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 08:50:32 -0700 Subject: [PATCH 01/24] Removing AFJSONUtilities in favor of just using NSJSONSerialization --- AFNetworking/AFHTTPClient.m | 3 +- AFNetworking/AFJSONRequestOperation.m | 3 +- AFNetworking/AFJSONUtilities.h | 26 --- AFNetworking/AFJSONUtilities.m | 217 ------------------ .../project.pbxproj | 6 - .../project.pbxproj | 6 - 6 files changed, 2 insertions(+), 259 deletions(-) delete mode 100644 AFNetworking/AFJSONUtilities.h delete mode 100644 AFNetworking/AFJSONUtilities.m diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index b116f3c..fa03444 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -24,7 +24,6 @@ #import "AFHTTPClient.h" #import "AFHTTPRequestOperation.h" -#import "AFJSONUtilities.h" #import @@ -195,7 +194,7 @@ NSArray * AFQueryStringComponentsFromKeyAndArrayValue(NSString *key, NSArray *va static NSString * AFJSONStringFromParameters(NSDictionary *parameters) { NSError *error = nil; - NSData *JSONData = AFJSONEncode(parameters, &error); + NSData *JSONData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error];; if (!error) { return [[[NSString alloc] initWithData:JSONData encoding:NSUTF8StringEncoding] autorelease]; diff --git a/AFNetworking/AFJSONRequestOperation.m b/AFNetworking/AFJSONRequestOperation.m index bcdcb7f..133293b 100644 --- a/AFNetworking/AFJSONRequestOperation.m +++ b/AFNetworking/AFJSONRequestOperation.m @@ -21,7 +21,6 @@ // THE SOFTWARE. #import "AFJSONRequestOperation.h" -#import "AFJSONUtilities.h" static dispatch_queue_t af_json_request_operation_processing_queue; static dispatch_queue_t json_request_operation_processing_queue() { @@ -72,7 +71,7 @@ static dispatch_queue_t json_request_operation_processing_queue() { if ([self.responseData length] == 0) { self.responseJSON = nil; } else { - self.responseJSON = AFJSONDecode(self.responseData, &error); + self.responseJSON = [NSJSONSerialization JSONObjectWithData:self.responseData options:0 error:&error]; } self.JSONError = error; diff --git a/AFNetworking/AFJSONUtilities.h b/AFNetworking/AFJSONUtilities.h deleted file mode 100644 index ece26a0..0000000 --- a/AFNetworking/AFJSONUtilities.h +++ /dev/null @@ -1,26 +0,0 @@ -// AFJSONUtilities.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -extern NSData * AFJSONEncode(id object, NSError **error); -extern id AFJSONDecode(NSData *data, NSError **error); diff --git a/AFNetworking/AFJSONUtilities.m b/AFNetworking/AFJSONUtilities.m deleted file mode 100644 index 3377fc4..0000000 --- a/AFNetworking/AFJSONUtilities.m +++ /dev/null @@ -1,217 +0,0 @@ -// AFJSONUtilities.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "AFJSONUtilities.h" - -NSData * AFJSONEncode(id object, NSError **error) { - NSData *data = nil; - - SEL _JSONKitSelector = NSSelectorFromString(@"JSONDataWithOptions:error:"); - SEL _YAJLSelector = NSSelectorFromString(@"yajl_JSONString"); - - id _SBJsonWriterClass = NSClassFromString(@"SBJsonWriter"); - SEL _SBJsonWriterSelector = NSSelectorFromString(@"dataWithObject:"); - - id _NXJsonSerializerClass = NSClassFromString(@"NXJsonSerializer"); - SEL _NXJsonSerializerSelector = NSSelectorFromString(@"serialize:"); - - id _NSJSONSerializationClass = NSClassFromString(@"NSJSONSerialization"); - SEL _NSJSONSerializationSelector = NSSelectorFromString(@"dataWithJSONObject:options:error:"); - -#ifdef _AFNETWORKING_PREFER_NSJSONSERIALIZATION_ - if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) { - goto _af_nsjson_encode; - } -#endif - - if (_JSONKitSelector && [object respondsToSelector:_JSONKitSelector]) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:_JSONKitSelector]]; - invocation.target = object; - invocation.selector = _JSONKitSelector; - - NSUInteger serializeOptionFlags = 0; - [invocation setArgument:&serializeOptionFlags atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - if (error != NULL) { - [invocation setArgument:error atIndex:3]; - } - - [invocation invoke]; - [invocation getReturnValue:&data]; - } else if (_SBJsonWriterClass && [_SBJsonWriterClass instancesRespondToSelector:_SBJsonWriterSelector]) { - id writer = [[_SBJsonWriterClass alloc] init]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[writer methodSignatureForSelector:_SBJsonWriterSelector]]; - invocation.target = writer; - invocation.selector = _SBJsonWriterSelector; - - [invocation setArgument:&object atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - - [invocation invoke]; - [invocation getReturnValue:&data]; - [writer release]; - } else if (_YAJLSelector && [object respondsToSelector:_YAJLSelector]) { - @try { - NSString *JSONString = nil; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:_YAJLSelector]]; - invocation.target = object; - invocation.selector = _YAJLSelector; - - [invocation invoke]; - [invocation getReturnValue:&JSONString]; - - data = [JSONString dataUsingEncoding:NSUTF8StringEncoding]; - } - @catch (NSException *exception) { - *error = [[[NSError alloc] initWithDomain:NSStringFromClass([exception class]) code:0 userInfo:[exception userInfo]] autorelease]; - } - } else if (_NXJsonSerializerClass && [_NXJsonSerializerClass respondsToSelector:_NXJsonSerializerSelector]) { - NSString *JSONString = nil; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NXJsonSerializerClass methodSignatureForSelector:_NXJsonSerializerSelector]]; - invocation.target = _NXJsonSerializerClass; - invocation.selector = _NXJsonSerializerSelector; - - [invocation setArgument:&object atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - - [invocation invoke]; - [invocation getReturnValue:&JSONString]; - data = [JSONString dataUsingEncoding:NSUTF8StringEncoding]; - } else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) { -#ifdef _AFNETWORKING_PREFER_NSJSONSERIALIZATION_ - _af_nsjson_encode:; -#endif - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NSJSONSerializationClass methodSignatureForSelector:_NSJSONSerializationSelector]]; - invocation.target = _NSJSONSerializationClass; - invocation.selector = _NSJSONSerializationSelector; - - [invocation setArgument:&object atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - NSUInteger writeOptions = 0; - [invocation setArgument:&writeOptions atIndex:3]; - if (error != NULL) { - [invocation setArgument:error atIndex:4]; - } - - [invocation invoke]; - [invocation getReturnValue:&data]; - } else { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedString(@"Please either target a platform that supports NSJSONSerialization or add one of the following libraries to your project: JSONKit, SBJSON, or YAJL", nil) forKey:NSLocalizedRecoverySuggestionErrorKey]; - [[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON generation functionality available", nil) userInfo:userInfo] raise]; - } - - return data; -} - -id AFJSONDecode(NSData *data, NSError **error) { - id JSON = nil; - - SEL _JSONKitSelector = NSSelectorFromString(@"objectFromJSONDataWithParseOptions:error:"); - SEL _YAJLSelector = NSSelectorFromString(@"yajl_JSONWithOptions:error:"); - - id _SBJSONParserClass = NSClassFromString(@"SBJsonParser"); - SEL _SBJSONParserSelector = NSSelectorFromString(@"objectWithData:"); - - id _NSJSONSerializationClass = NSClassFromString(@"NSJSONSerialization"); - SEL _NSJSONSerializationSelector = NSSelectorFromString(@"JSONObjectWithData:options:error:"); - - id _NXJsonParserClass = NSClassFromString(@"NXJsonParser"); - SEL _NXJsonParserSelector = NSSelectorFromString(@"parseData:error:ignoreNulls:"); - - -#ifdef _AFNETWORKING_PREFER_NSJSONSERIALIZATION_ - if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) { - goto _af_nsjson_decode; - } -#endif - - if (_JSONKitSelector && [data respondsToSelector:_JSONKitSelector]) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[data methodSignatureForSelector:_JSONKitSelector]]; - invocation.target = data; - invocation.selector = _JSONKitSelector; - - NSUInteger parseOptionFlags = 0; - [invocation setArgument:&parseOptionFlags atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - if (error != NULL) { - [invocation setArgument:&error atIndex:3]; - } - - [invocation invoke]; - [invocation getReturnValue:&JSON]; - } else if (_SBJSONParserClass && [_SBJSONParserClass instancesRespondToSelector:_SBJSONParserSelector]) { - id parser = [[_SBJSONParserClass alloc] init]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[parser methodSignatureForSelector:_SBJSONParserSelector]]; - invocation.target = parser; - invocation.selector = _SBJSONParserSelector; - - [invocation setArgument:&data atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - - [invocation invoke]; - [invocation getReturnValue:&JSON]; - [parser release]; - } else if (_YAJLSelector && [data respondsToSelector:_YAJLSelector]) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[data methodSignatureForSelector:_YAJLSelector]]; - invocation.target = data; - invocation.selector = _YAJLSelector; - - NSUInteger yajlParserOptions = 0; - [invocation setArgument:&yajlParserOptions atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - if (error != NULL) { - [invocation setArgument:&error atIndex:3]; - } - - [invocation invoke]; - [invocation getReturnValue:&JSON]; - } else if (_NXJsonParserClass && [_NXJsonParserClass respondsToSelector:_NXJsonParserSelector]) { - NSNumber *nullOption = [NSNumber numberWithBool:YES]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NXJsonParserClass methodSignatureForSelector:_NXJsonParserSelector]]; - invocation.target = _NXJsonParserClass; - invocation.selector = _NXJsonParserSelector; - - [invocation setArgument:&data atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - if (error != NULL) { - [invocation setArgument:&error atIndex:3]; - } - [invocation setArgument:&nullOption atIndex:4]; - - [invocation invoke]; - [invocation getReturnValue:&JSON]; - } else if (_NSJSONSerializationClass && [_NSJSONSerializationClass respondsToSelector:_NSJSONSerializationSelector]) { -#ifdef _AFNETWORKING_PREFER_NSJSONSERIALIZATION_ - _af_nsjson_decode:; -#endif - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[_NSJSONSerializationClass methodSignatureForSelector:_NSJSONSerializationSelector]]; - invocation.target = _NSJSONSerializationClass; - invocation.selector = _NSJSONSerializationSelector; - - [invocation setArgument:&data atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation - NSUInteger readOptions = 0; - [invocation setArgument:&readOptions atIndex:3]; - if (error != NULL) { - [invocation setArgument:&error atIndex:4]; - } - - [invocation invoke]; - [invocation getReturnValue:&JSON]; - } else { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedString(@"Please either target a platform that supports NSJSONSerialization or add one of the following libraries to your project: JSONKit, SBJSON, or YAJL", nil) forKey:NSLocalizedRecoverySuggestionErrorKey]; - [[NSException exceptionWithName:NSInternalInconsistencyException reason:NSLocalizedString(@"No JSON parsing functionality available", nil) userInfo:userInfo] raise]; - } - - return JSON; -} diff --git a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj index fd75074..e537260 100644 --- a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj @@ -15,7 +15,6 @@ F8129C641591090B009BFE23 /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C511591090B009BFE23 /* AFHTTPRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8129C651591090B009BFE23 /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C531591090B009BFE23 /* AFImageRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8129C661591090B009BFE23 /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C551591090B009BFE23 /* AFJSONRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C671591090B009BFE23 /* AFJSONUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C571591090B009BFE23 /* AFJSONUtilities.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8129C681591090B009BFE23 /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C591591090B009BFE23 /* AFNetworkActivityIndicatorManager.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8129C691591090B009BFE23 /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C5C1591090B009BFE23 /* AFPropertyListRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8129C6A1591090B009BFE23 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C5E1591090B009BFE23 /* AFURLConnectionOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; @@ -46,8 +45,6 @@ F8129C531591090B009BFE23 /* AFImageRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFImageRequestOperation.m; path = ../AFNetworking/AFImageRequestOperation.m; sourceTree = ""; }; F8129C541591090B009BFE23 /* AFJSONRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFJSONRequestOperation.h; path = ../AFNetworking/AFJSONRequestOperation.h; sourceTree = ""; }; F8129C551591090B009BFE23 /* AFJSONRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFJSONRequestOperation.m; path = ../AFNetworking/AFJSONRequestOperation.m; sourceTree = ""; }; - F8129C561591090B009BFE23 /* AFJSONUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFJSONUtilities.h; path = ../AFNetworking/AFJSONUtilities.h; sourceTree = ""; }; - F8129C571591090B009BFE23 /* AFJSONUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFJSONUtilities.m; path = ../AFNetworking/AFJSONUtilities.m; sourceTree = ""; }; F8129C581591090B009BFE23 /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworkActivityIndicatorManager.h; path = ../AFNetworking/AFNetworkActivityIndicatorManager.h; sourceTree = ""; }; F8129C591591090B009BFE23 /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFNetworkActivityIndicatorManager.m; path = ../AFNetworking/AFNetworkActivityIndicatorManager.m; sourceTree = ""; }; F8129C5A1591090B009BFE23 /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = ../AFNetworking/AFNetworking.h; sourceTree = ""; }; @@ -160,8 +157,6 @@ F8129C531591090B009BFE23 /* AFImageRequestOperation.m */, F8129C541591090B009BFE23 /* AFJSONRequestOperation.h */, F8129C551591090B009BFE23 /* AFJSONRequestOperation.m */, - F8129C561591090B009BFE23 /* AFJSONUtilities.h */, - F8129C571591090B009BFE23 /* AFJSONUtilities.m */, F8129C581591090B009BFE23 /* AFNetworkActivityIndicatorManager.h */, F8129C591591090B009BFE23 /* AFNetworkActivityIndicatorManager.m */, F8129C5A1591090B009BFE23 /* AFNetworking.h */, @@ -245,7 +240,6 @@ F8129C641591090B009BFE23 /* AFHTTPRequestOperation.m in Sources */, F8129C651591090B009BFE23 /* AFImageRequestOperation.m in Sources */, F8129C661591090B009BFE23 /* AFJSONRequestOperation.m in Sources */, - F8129C671591090B009BFE23 /* AFJSONUtilities.m in Sources */, F8129C681591090B009BFE23 /* AFNetworkActivityIndicatorManager.m in Sources */, F8129C691591090B009BFE23 /* AFPropertyListRequestOperation.m in Sources */, F8129C6A1591090B009BFE23 /* AFURLConnectionOperation.m in Sources */, diff --git a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj index 7abdbab..da11cae 100644 --- a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ F8FA94B2150EFEC100ED4EAD /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA949F150EFEC100ED4EAD /* AFHTTPRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8FA94B3150EFEC100ED4EAD /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A1150EFEC100ED4EAD /* AFImageRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8FA94B4150EFEC100ED4EAD /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A3150EFEC100ED4EAD /* AFJSONRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B5150EFEC100ED4EAD /* AFJSONUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A5150EFEC100ED4EAD /* AFJSONUtilities.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8FA94B6150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A7150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8FA94B7150EFEC100ED4EAD /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AA150EFEC100ED4EAD /* AFPropertyListRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8FA94B8150EFEC100ED4EAD /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AC150EFEC100ED4EAD /* AFURLConnectionOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; @@ -71,8 +70,6 @@ F8FA94A1150EFEC100ED4EAD /* AFImageRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFImageRequestOperation.m; sourceTree = ""; }; F8FA94A2150EFEC100ED4EAD /* AFJSONRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFJSONRequestOperation.h; sourceTree = ""; }; F8FA94A3150EFEC100ED4EAD /* AFJSONRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFJSONRequestOperation.m; sourceTree = ""; }; - F8FA94A4150EFEC100ED4EAD /* AFJSONUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFJSONUtilities.h; sourceTree = ""; }; - F8FA94A5150EFEC100ED4EAD /* AFJSONUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFJSONUtilities.m; sourceTree = ""; }; F8FA94A6150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkActivityIndicatorManager.h; sourceTree = ""; }; F8FA94A7150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkActivityIndicatorManager.m; sourceTree = ""; }; F8FA94A8150EFEC100ED4EAD /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworking.h; sourceTree = ""; }; @@ -249,8 +246,6 @@ F8FA94B0150EFEC100ED4EAD /* UIImageView+AFNetworking.m */, F8FA94A6150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.h */, F8FA94A7150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m */, - F8FA94A4150EFEC100ED4EAD /* AFJSONUtilities.h */, - F8FA94A5150EFEC100ED4EAD /* AFJSONUtilities.m */, ); name = AFNetworking; path = ../AFNetworking; @@ -332,7 +327,6 @@ F8FA94B2150EFEC100ED4EAD /* AFHTTPRequestOperation.m in Sources */, F8FA94B3150EFEC100ED4EAD /* AFImageRequestOperation.m in Sources */, F8FA94B4150EFEC100ED4EAD /* AFJSONRequestOperation.m in Sources */, - F8FA94B5150EFEC100ED4EAD /* AFJSONUtilities.m in Sources */, F8FA94B6150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m in Sources */, F8FA94B7150EFEC100ED4EAD /* AFPropertyListRequestOperation.m in Sources */, F8FA94B8150EFEC100ED4EAD /* AFURLConnectionOperation.m in Sources */, From de76f997fbbfb03293c15e8077f63b1ee63433cf Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 08:52:01 -0700 Subject: [PATCH 02/24] Setting deployment target to iOS 5.0 --- Example/AFNetworking iOS Example.xcodeproj/project.pbxproj | 4 ++-- Example/iOS-Info.plist | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj index da11cae..39e7fc7 100644 --- a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj @@ -386,7 +386,7 @@ GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_UNUSED_PARAMETER = NO; INFOPLIST_FILE = "iOS-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -405,7 +405,7 @@ GCC_WARN_SIGN_COMPARE = YES; GCC_WARN_UNUSED_PARAMETER = NO; INFOPLIST_FILE = "iOS-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; PRODUCT_NAME = "$(TARGET_NAME)"; VALIDATE_PRODUCT = YES; WRAPPER_EXTENSION = app; diff --git a/Example/iOS-Info.plist b/Example/iOS-Info.plist index 3ce184f..7e523a4 100644 --- a/Example/iOS-Info.plist +++ b/Example/iOS-Info.plist @@ -41,14 +41,14 @@ CFBundleSignature ???? CFBundleVersion - 0.1.0 + 1.0.0 LSRequiresIPhoneOS + UIPrerenderedIcon + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait - UIPrerenderedIcon - From b420c181eda78296fa9955b3d09d1aac1c21340f Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 08:53:15 -0700 Subject: [PATCH 03/24] Adding compiler directive to ignore User +sharedProfileImageRequestOperationQueue in iOS --- Example/Classes/Models/User.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Example/Classes/Models/User.m b/Example/Classes/Models/User.m index 6f54c7f..18da822 100644 --- a/Example/Classes/Models/User.m +++ b/Example/Classes/Models/User.m @@ -25,9 +25,11 @@ NSString * const kUserProfileImageDidLoadNotification = @"com.alamofire.user.profile-image.loaded"; +#if __MAC_OS_X_VERSION_MIN_REQUIRED @interface User () + (NSOperationQueue *)sharedProfileImageRequestOperationQueue; @end +#endif @implementation User { @private From f1b3101a630d68aa4a15237a7c912d33051b9ea1 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:14:52 -0700 Subject: [PATCH 04/24] First pass at converting to ARC --- AFNetworking/AFHTTPClient.h | 4 +- AFNetworking/AFHTTPClient.m | 78 +++++-------- AFNetworking/AFHTTPRequestOperation.h | 2 +- AFNetworking/AFHTTPRequestOperation.m | 39 +++---- AFNetworking/AFImageRequestOperation.h | 2 +- AFNetworking/AFImageRequestOperation.m | 28 ++--- AFNetworking/AFJSONRequestOperation.h | 2 +- AFNetworking/AFJSONRequestOperation.m | 30 +++-- .../AFNetworkActivityIndicatorManager.m | 4 +- AFNetworking/AFPropertyListRequestOperation.h | 2 +- AFNetworking/AFPropertyListRequestOperation.m | 30 +++-- AFNetworking/AFURLConnectionOperation.h | 14 +-- AFNetworking/AFURLConnectionOperation.m | 52 +++------ AFNetworking/AFXMLRequestOperation.h | 2 +- AFNetworking/AFXMLRequestOperation.m | 36 +++--- AFNetworking/UIImageView+AFNetworking.m | 2 +- .../project.pbxproj | 108 +++++++++--------- .../project.pbxproj | 18 +-- Example/AppDelegate.h | 2 +- Example/Classes/Models/Tweet.h | 6 +- Example/Classes/Models/Tweet.m | 8 +- Example/Classes/Models/User.h | 2 +- 22 files changed, 197 insertions(+), 274 deletions(-) diff --git a/AFNetworking/AFHTTPClient.h b/AFNetworking/AFHTTPClient.h index 6d11918..249eef9 100644 --- a/AFNetworking/AFHTTPClient.h +++ b/AFNetworking/AFHTTPClient.h @@ -134,7 +134,7 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete /** The url used as the base for paths specified in methods such as `getPath:parameteres:success:failure` */ -@property (readonly, nonatomic, retain) NSURL *baseURL; +@property (readonly, nonatomic) NSURL *baseURL; /** The string encoding used in constructing url requests. This is `NSUTF8StringEncoding` by default. @@ -151,7 +151,7 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete /** The operation queue which manages operations enqueued by the HTTP client. */ -@property (readonly, nonatomic, retain) NSOperationQueue *operationQueue; +@property (readonly, nonatomic) NSOperationQueue *operationQueue; /** The reachability status from the device to the current `baseURL` of the `AFHTTPClient`. diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index fa03444..5040059 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -90,25 +90,21 @@ static NSString * AFBase64EncodedStringFromString(NSString *string) { output[idx + 3] = (i + 2) < length ? kAFBase64EncodingTable[(value >> 0) & 0x3F] : '='; } - return [[[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding] autorelease]; + return [[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding]; } NSString * AFURLEncodedStringFromStringWithEncoding(NSString *string, NSStringEncoding encoding) { static NSString * const kAFLegalCharactersToBeEscaped = @"?!@#$^&%*+=,:;'\"`<>()[]{}/\\|~ "; - return [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, (CFStringRef)kAFLegalCharactersToBeEscaped, CFStringConvertNSStringEncodingToEncoding(encoding)) autorelease]; + return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, (__bridge CFStringRef)kAFLegalCharactersToBeEscaped, CFStringConvertNSStringEncodingToEncoding(encoding)); } #pragma mark - -@interface AFQueryStringComponent : NSObject { -@private - NSString *_key; - NSString *_value; -} +@interface AFQueryStringComponent : NSObject -@property (readwrite, nonatomic, retain) id key; -@property (readwrite, nonatomic, retain) id value; +@property (readwrite, nonatomic) id key; +@property (readwrite, nonatomic) id value; - (id)initWithKey:(id)key value:(id)value; - (NSString *)URLEncodedStringValueWithEncoding:(NSStringEncoding)stringEncoding; @@ -125,18 +121,12 @@ NSString * AFURLEncodedStringFromStringWithEncoding(NSString *string, NSStringEn return nil; } - self.key = key; - self.value = value; + _key = key; + _value = value; return self; } -- (void)dealloc { - [_key release]; - [_value release]; - [super dealloc]; -} - - (NSString *)URLEncodedStringValueWithEncoding:(NSStringEncoding)stringEncoding { return [NSString stringWithFormat:@"%@=%@", self.key, AFURLEncodedStringFromStringWithEncoding([self.value description], stringEncoding)]; } @@ -166,7 +156,7 @@ NSArray * AFQueryStringComponentsFromKeyAndValue(NSString *key, id value) { } else if([value isKindOfClass:[NSArray class]]) { [mutableQueryStringComponents addObjectsFromArray:AFQueryStringComponentsFromKeyAndArrayValue(key, value)]; } else { - [mutableQueryStringComponents addObject:[[[AFQueryStringComponent alloc] initWithKey:key value:value] autorelease]]; + [mutableQueryStringComponents addObject:[[AFQueryStringComponent alloc] initWithKey:key value:value]]; } return mutableQueryStringComponents; @@ -197,7 +187,7 @@ static NSString * AFJSONStringFromParameters(NSDictionary *parameters) { NSData *JSONData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error];; if (!error) { - return [[[NSString alloc] initWithData:JSONData encoding:NSUTF8StringEncoding] autorelease]; + return [[NSString alloc] initWithData:JSONData encoding:NSUTF8StringEncoding]; } else { return nil; } @@ -209,17 +199,17 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) { NSData *propertyListData = [NSPropertyListSerialization dataWithPropertyList:parameters format:NSPropertyListXMLFormat_v1_0 options:0 error:&error]; if (!error) { - propertyListString = [[[NSString alloc] initWithData:propertyListData encoding:NSUTF8StringEncoding] autorelease]; + propertyListString = [[NSString alloc] initWithData:propertyListData encoding:NSUTF8StringEncoding] ; } return propertyListString; } @interface AFHTTPClient () -@property (readwrite, nonatomic, retain) NSURL *baseURL; -@property (readwrite, nonatomic, retain) NSMutableArray *registeredHTTPOperationClassNames; -@property (readwrite, nonatomic, retain) NSMutableDictionary *defaultHeaders; -@property (readwrite, nonatomic, retain) NSOperationQueue *operationQueue; +@property (readwrite, nonatomic) NSURL *baseURL; +@property (readwrite, nonatomic) NSMutableArray *registeredHTTPOperationClassNames; +@property (readwrite, nonatomic) NSMutableDictionary *defaultHeaders; +@property (readwrite, nonatomic) NSOperationQueue *operationQueue; #ifdef _SYSTEMCONFIGURATION_H @property (readwrite, nonatomic, assign) AFNetworkReachabilityRef networkReachability; @property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; @@ -246,7 +236,7 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) { #endif + (AFHTTPClient *)clientWithBaseURL:(NSURL *)url { - return [[[self alloc] initWithBaseURL:url] autorelease]; + return [[self alloc] initWithBaseURL:url]; } - (id)initWithBaseURL:(NSURL *)url { @@ -283,7 +273,7 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) { [self startMonitoringNetworkReachability]; #endif - self.operationQueue = [[[NSOperationQueue alloc] init] autorelease]; + self.operationQueue = [[NSOperationQueue alloc] init]; [self.operationQueue setMaxConcurrentOperationCount:kAFHTTPClientDefaultMaxConcurrentOperationCount]; return self; @@ -292,15 +282,9 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) { - (void)dealloc { #ifdef _SYSTEMCONFIGURATION_H [self stopMonitoringNetworkReachability]; - [_networkReachabilityStatusBlock release]; #endif - [_baseURL release]; - [_registeredHTTPOperationClassNames release]; - [_defaultHeaders release]; - [_operationQueue release]; - [super dealloc]; } - (NSString *)description { @@ -340,7 +324,7 @@ static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetwork static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); - AFNetworkReachabilityStatusBlock block = (AFNetworkReachabilityStatusBlock)info; + AFNetworkReachabilityStatusBlock block = (__bridge AFNetworkReachabilityStatusBlock)info; if (block) { block(status); } @@ -349,11 +333,10 @@ static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused targ } static const void * AFNetworkReachabilityRetainCallback(const void *info) { - return [(AFNetworkReachabilityStatusBlock)info copy]; + return (__bridge_retained const void *)([(__bridge AFNetworkReachabilityStatusBlock)info copy]); } static void AFNetworkReachabilityReleaseCallback(const void *info) { - [(AFNetworkReachabilityStatusBlock)info release]; } - (void)startMonitoringNetworkReachability { @@ -372,7 +355,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { } }; - SCNetworkReachabilityContext context = {0, callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; + SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), (CFStringRef)NSRunLoopCommonModes); @@ -449,7 +432,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { parameters:(NSDictionary *)parameters { NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL]; - NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] initWithURL:url] autorelease]; + NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setHTTPMethod:method]; [request setAllHTTPHeaderFields:self.defaultHeaders]; @@ -462,7 +445,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { url = [NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:[path rangeOfString:@"?"].location == NSNotFound ? @"?%@" : @"&%@", AFQueryStringFromParametersWithEncoding(parameters, self.stringEncoding)]]; [request setURL:url]; } else { - NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(self.stringEncoding)); + NSString *charset = (__bridge NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(self.stringEncoding)); switch (self.parameterEncoding) { case AFFormURLParameterEncoding:; [request setValue:[NSString stringWithFormat:@"application/x-www-form-urlencoded; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; @@ -489,7 +472,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { constructingBodyWithBlock:(void (^)(id formData))block { NSMutableURLRequest *request = [self requestWithMethod:method path:path parameters:nil]; - __block AFMultipartFormData *formData = [[[AFMultipartFormData alloc] initWithURLRequest:request stringEncoding:self.stringEncoding] autorelease]; + __block AFMultipartFormData *formData = [[AFMultipartFormData alloc] initWithURLRequest:request stringEncoding:self.stringEncoding]; if (parameters) { for (AFQueryStringComponent *component in AFQueryStringComponentsFromKeyAndValue(nil, parameters)) { @@ -523,12 +506,12 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { while (!operation && (className = [enumerator nextObject])) { Class op_class = NSClassFromString(className); if (op_class && [op_class canProcessRequest:urlRequest]) { - operation = [[(AFHTTPRequestOperation *)[op_class alloc] initWithRequest:urlRequest] autorelease]; + operation = [(AFHTTPRequestOperation *)[op_class alloc] initWithRequest:urlRequest]; } } if (!operation) { - operation = [[[AFHTTPRequestOperation alloc] initWithRequest:urlRequest] autorelease]; + operation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; } [operation setCompletionBlockWithSuccess:success failure:failure]; @@ -584,7 +567,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { NSPredicate *finishedOperationPredicate = [NSPredicate predicateWithFormat:@"isFinished == YES"]; for (AFHTTPRequestOperation *operation in operations) { - AFCompletionBlock originalCompletionBlock = [[operation.completionBlock copy] autorelease]; + AFCompletionBlock originalCompletionBlock = [operation.completionBlock copy]; operation.completionBlock = ^{ dispatch_queue_t queue = operation.successCallbackQueue ? operation.successCallbackQueue : dispatch_get_main_queue(); dispatch_group_async(dispatchGroup, queue, ^{ @@ -698,9 +681,9 @@ static inline NSString * AFMultipartFormFinalBoundary() { } @interface AFMultipartFormData () -@property (readwrite, nonatomic, retain) NSMutableURLRequest *request; +@property (readwrite, nonatomic) NSMutableURLRequest *request; @property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; -@property (readwrite, nonatomic, retain) NSOutputStream *outputStream; +@property (readwrite, nonatomic) NSOutputStream *outputStream; @property (readwrite, nonatomic, copy) NSString *temporaryFilePath; @end @@ -732,16 +715,11 @@ static inline NSString * AFMultipartFormFinalBoundary() { } - (void)dealloc { - [_request release]; if (_outputStream) { [_outputStream close]; - [_outputStream release]; - _outputStream = nil; } - [_temporaryFilePath release]; - [super dealloc]; } - (NSMutableURLRequest *)requestByFinalizingMultipartFormData { @@ -816,7 +794,7 @@ static inline NSString * AFMultipartFormFinalBoundary() { [userInfo setValue:fileURL forKey:NSURLErrorFailingURLErrorKey]; [userInfo setValue:NSLocalizedString(@"Expected URL to be a file URL", nil) forKey:NSLocalizedFailureReasonErrorKey]; if (error != NULL) { - *error = [[[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadURL userInfo:userInfo] autorelease]; + *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; } return NO; diff --git a/AFNetworking/AFHTTPRequestOperation.h b/AFNetworking/AFHTTPRequestOperation.h index 9cab0e5..52de1f7 100644 --- a/AFNetworking/AFHTTPRequestOperation.h +++ b/AFNetworking/AFHTTPRequestOperation.h @@ -42,7 +42,7 @@ extern NSString * AFCreateIncompleteDownloadDirectoryPath(void); /** The last HTTP response received by the operation's connection. */ -@property (readonly, nonatomic, retain) NSHTTPURLResponse *response; +@property (readonly, nonatomic, strong) NSHTTPURLResponse *response; /** Set a target file for the response, will stream directly into this destination. diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index bc9b2b7..fea0235 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -29,7 +29,7 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) { static NSCharacterSet *_skippedCharacterSet = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - _skippedCharacterSet = [[NSCharacterSet characterSetWithCharactersInString:@" ,"] retain]; + _skippedCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@" ,"]; }); if (!string) { @@ -96,14 +96,13 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSString *tempDirectory = NSTemporaryDirectory(); - incompleteDownloadPath = [[tempDirectory stringByAppendingPathComponent:kAFNetworkingIncompleteDownloadDirectoryName] retain]; + incompleteDownloadPath = [tempDirectory stringByAppendingPathComponent:kAFNetworkingIncompleteDownloadDirectoryName]; NSError *error = nil; NSFileManager *fileMan = [[NSFileManager alloc] init]; if(![fileMan createDirectoryAtPath:incompleteDownloadPath withIntermediateDirectories:YES attributes:nil error:&error]) { NSLog(@"Failed to create incomplete downloads directory at %@", incompleteDownloadPath); } - [fileMan release]; }); return incompleteDownloadPath; @@ -112,9 +111,9 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { #pragma mark - @interface AFHTTPRequestOperation () -@property (readwrite, nonatomic, retain) NSURLRequest *request; -@property (readwrite, nonatomic, retain) NSHTTPURLResponse *response; -@property (readwrite, nonatomic, retain) NSError *HTTPError; +@property (readwrite, nonatomic, strong) NSURLRequest *request; +@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response; +@property (readwrite, nonatomic, strong) NSError *HTTPError; @property (assign) long long totalContentLength; @property (assign) long long offsetContentLength; @end @@ -130,7 +129,6 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { @dynamic response; - (void)dealloc { - [_HTTPError release]; if (_successCallbackQueue) { dispatch_release(_successCallbackQueue); @@ -142,7 +140,6 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { _failureCallbackQueue = NULL; } - [super dealloc]; } - (NSError *)error { @@ -152,13 +149,13 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { [userInfo setValue:[NSString stringWithFormat:NSLocalizedString(@"Expected status code in (%@), got %d", nil), AFStringFromIndexSet([[self class] acceptableStatusCodes]), [self.response statusCode]] forKey:NSLocalizedDescriptionKey]; [userInfo setValue:[self.request URL] forKey:NSURLErrorFailingURLErrorKey]; - self.HTTPError = [[[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo] autorelease]; + self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo]; } else if ([self.responseData length] > 0 && ![self hasAcceptableContentType]) { // Don't invalidate content type if there is no content NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; [userInfo setValue:[NSString stringWithFormat:NSLocalizedString(@"Expected content type %@, got %@", nil), [[self class] acceptableContentTypes], [self.response MIMEType]] forKey:NSLocalizedDescriptionKey]; [userInfo setValue:[self.request URL] forKey:NSURLErrorFailingURLErrorKey]; - self.HTTPError = [[[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo] autorelease]; + self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo]; } } @@ -177,7 +174,7 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { offset = [[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length]; } - NSMutableURLRequest *mutableURLRequest = [[self.request mutableCopy] autorelease]; + NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy]; if ([[self.response allHeaderFields] valueForKey:@"ETag"]) { [mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"]; } @@ -226,21 +223,22 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { + __weak AFHTTPRequestOperation *weakSelf = self; self.completionBlock = ^ { - if ([self isCancelled]) { + if ([weakSelf isCancelled]) { return; } - if (self.error) { + if (weakSelf.error) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { if (success) { - dispatch_async(self.successCallbackQueue ? self.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(self, self.responseData); + dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ + success(weakSelf, weakSelf.responseData); }); } } @@ -249,8 +247,7 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { - (void)setResponseFilePath:(NSString *)responseFilePath { if ([self isReady] && responseFilePath != _responseFilePath) { - [_responseFilePath release]; - _responseFilePath = [responseFilePath retain]; + _responseFilePath = responseFilePath; if (responseFilePath) { self.outputStream = [NSOutputStream outputStreamToFileAtPath:responseFilePath append:NO]; @@ -271,7 +268,7 @@ static id AFStaticClassValueImplementation(id self, SEL _cmd) { } + (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes { - NSMutableIndexSet *mutableStatusCodes = [[[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]] autorelease]; + NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]]; [mutableStatusCodes addIndexes:statusCodes]; SEL selector = @selector(acceptableStatusCodes); AFSwizzleClassMethodWithImplementation([self class], selector, (IMP)AFStaticClassValueImplementation); @@ -283,7 +280,7 @@ static id AFStaticClassValueImplementation(id self, SEL _cmd) { } + (void)addAcceptableContentTypes:(NSSet *)contentTypes { - NSMutableSet *mutableContentTypes = [[[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES] autorelease]; + NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES]; [mutableContentTypes unionSet:contentTypes]; SEL selector = @selector(acceptableContentTypes); AFSwizzleClassMethodWithImplementation([self class], selector, (IMP)AFStaticClassValueImplementation); diff --git a/AFNetworking/AFImageRequestOperation.h b/AFNetworking/AFImageRequestOperation.h index f6de586..c9c5f22 100644 --- a/AFNetworking/AFImageRequestOperation.h +++ b/AFNetworking/AFImageRequestOperation.h @@ -55,7 +55,7 @@ An image constructed from the response data. If an error occurs during the request, `nil` will be returned, and the `error` property will be set to the error. */ #if __IPHONE_OS_VERSION_MIN_REQUIRED -@property (readonly, nonatomic, retain) UIImage *responseImage; +@property (readonly, nonatomic) UIImage *responseImage; #elif __MAC_OS_X_VERSION_MIN_REQUIRED @property (readonly, nonatomic, retain) NSImage *responseImage; #endif diff --git a/AFNetworking/AFImageRequestOperation.m b/AFNetworking/AFImageRequestOperation.m index beeae69..3b13463 100644 --- a/AFNetworking/AFImageRequestOperation.m +++ b/AFNetworking/AFImageRequestOperation.m @@ -33,7 +33,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { @interface AFImageRequestOperation () #if __IPHONE_OS_VERSION_MIN_REQUIRED -@property (readwrite, nonatomic, retain) UIImage *responseImage; +@property (readwrite, nonatomic) UIImage *responseImage; #elif __MAC_OS_X_VERSION_MIN_REQUIRED @property (readwrite, nonatomic, retain) NSImage *responseImage; #endif @@ -74,7 +74,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure { - AFImageRequestOperation *requestOperation = [[[AFImageRequestOperation alloc] initWithRequest:urlRequest] autorelease]; + AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if (success) { UIImage *image = responseObject; @@ -105,7 +105,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure { - AFImageRequestOperation *requestOperation = [[[AFImageRequestOperation alloc] initWithRequest:urlRequest] autorelease]; + AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if (success) { NSImage *image = responseObject; @@ -144,10 +144,6 @@ static dispatch_queue_t image_request_operation_processing_queue() { return self; } -- (void)dealloc { - [_responseImage release]; - [super dealloc]; -} #if __IPHONE_OS_VERSION_MIN_REQUIRED - (UIImage *)responseImage { @@ -174,9 +170,8 @@ static dispatch_queue_t image_request_operation_processing_queue() { if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) { // Ensure that the image is set to it's correct pixel width and height NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:self.responseData]; - self.responseImage = [[[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])] autorelease]; + self.responseImage = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])]; [self.responseImage addRepresentation:bitimage]; - [bitimage release]; } return _responseImage; @@ -202,16 +197,17 @@ static dispatch_queue_t image_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { + __weak AFImageRequestOperation *weakSelf = self; self.completionBlock = ^ { - if ([self isCancelled]) { + if ([weakSelf isCancelled]) { return; } dispatch_async(image_request_operation_processing_queue(), ^(void) { - if (self.error) { + if (weakSelf.error) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { @@ -222,10 +218,10 @@ static dispatch_queue_t image_request_operation_processing_queue() { NSImage *image = nil; #endif - image = self.responseImage; + image = weakSelf.responseImage; - dispatch_async(self.successCallbackQueue ? self.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(self, image); + dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ + success(weakSelf, image); }); } } diff --git a/AFNetworking/AFJSONRequestOperation.h b/AFNetworking/AFJSONRequestOperation.h index a1191f9..bca959c 100644 --- a/AFNetworking/AFJSONRequestOperation.h +++ b/AFNetworking/AFJSONRequestOperation.h @@ -44,7 +44,7 @@ /** A JSON object constructed from the response data. If an error occurs while parsing, `nil` will be returned, and the `error` property will be set to the error. */ -@property (readonly, nonatomic, retain) id responseJSON; +@property (readonly, nonatomic) id responseJSON; ///---------------------------------- /// @name Creating Request Operations diff --git a/AFNetworking/AFJSONRequestOperation.m b/AFNetworking/AFJSONRequestOperation.m index 133293b..e6968d9 100644 --- a/AFNetworking/AFJSONRequestOperation.m +++ b/AFNetworking/AFJSONRequestOperation.m @@ -32,8 +32,8 @@ static dispatch_queue_t json_request_operation_processing_queue() { } @interface AFJSONRequestOperation () -@property (readwrite, nonatomic, retain) id responseJSON; -@property (readwrite, nonatomic, retain) NSError *JSONError; +@property (readwrite, nonatomic) id responseJSON; +@property (readwrite, nonatomic) NSError *JSONError; @end @implementation AFJSONRequestOperation @@ -44,7 +44,7 @@ static dispatch_queue_t json_request_operation_processing_queue() { success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id JSON))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON))failure { - AFJSONRequestOperation *requestOperation = [[[self alloc] initWithRequest:urlRequest] autorelease]; + AFJSONRequestOperation *requestOperation = [[self alloc] initWithRequest:urlRequest]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if (success) { success(operation.request, operation.response, responseObject); @@ -58,11 +58,6 @@ static dispatch_queue_t json_request_operation_processing_queue() { return requestOperation; } -- (void)dealloc { - [_responseJSON release]; - [_JSONError release]; - [super dealloc]; -} - (id)responseJSON { if (!_responseJSON && [self.responseData length] > 0 && [self isFinished] && !self.JSONError) { @@ -101,31 +96,32 @@ static dispatch_queue_t json_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { + __weak AFJSONRequestOperation *weakSelf = self; self.completionBlock = ^ { - if ([self isCancelled]) { + if ([weakSelf isCancelled]) { return; } - if (self.error) { + if (weakSelf.error) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { dispatch_async(json_request_operation_processing_queue(), ^{ - id JSON = self.responseJSON; + id JSON = weakSelf.responseJSON; if (self.JSONError) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { if (success) { - dispatch_async(self.successCallbackQueue ? self.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(self, JSON); + dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ + success(weakSelf, JSON); }); } } diff --git a/AFNetworking/AFNetworkActivityIndicatorManager.m b/AFNetworking/AFNetworkActivityIndicatorManager.m index b141323..dda196c 100644 --- a/AFNetworking/AFNetworkActivityIndicatorManager.m +++ b/AFNetworking/AFNetworkActivityIndicatorManager.m @@ -29,7 +29,7 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.25; @interface AFNetworkActivityIndicatorManager () @property (readwrite, atomic, assign) NSInteger activityCount; -@property (readwrite, nonatomic, retain) NSTimer *activityIndicatorVisibilityTimer; +@property (readwrite, nonatomic) NSTimer *activityIndicatorVisibilityTimer; @property (readonly, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; - (void)updateNetworkActivityIndicatorVisibility; @@ -67,9 +67,7 @@ static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.25; [[NSNotificationCenter defaultCenter] removeObserver:self]; [_activityIndicatorVisibilityTimer invalidate]; - [_activityIndicatorVisibilityTimer release]; _activityIndicatorVisibilityTimer = nil; - [super dealloc]; } - (void)updateNetworkActivityIndicatorVisibilityDelayed { diff --git a/AFNetworking/AFPropertyListRequestOperation.h b/AFNetworking/AFPropertyListRequestOperation.h index aa6e471..c509274 100644 --- a/AFNetworking/AFPropertyListRequestOperation.h +++ b/AFNetworking/AFPropertyListRequestOperation.h @@ -41,7 +41,7 @@ /** An object deserialized from a plist constructed using the response data. */ -@property (readonly, nonatomic, retain) id responsePropertyList; +@property (readonly, nonatomic) id responsePropertyList; ///-------------------------------------- /// @name Managing Property List Behavior diff --git a/AFNetworking/AFPropertyListRequestOperation.m b/AFNetworking/AFPropertyListRequestOperation.m index ecca1af..2cf0d9d 100644 --- a/AFNetworking/AFPropertyListRequestOperation.m +++ b/AFNetworking/AFPropertyListRequestOperation.m @@ -32,9 +32,9 @@ static dispatch_queue_t property_list_request_operation_processing_queue() { } @interface AFPropertyListRequestOperation () -@property (readwrite, nonatomic, retain) id responsePropertyList; +@property (readwrite, nonatomic) id responsePropertyList; @property (readwrite, nonatomic, assign) NSPropertyListFormat propertyListFormat; -@property (readwrite, nonatomic, retain) NSError *propertyListError; +@property (readwrite, nonatomic) NSError *propertyListError; @end @implementation AFPropertyListRequestOperation @@ -47,7 +47,7 @@ static dispatch_queue_t property_list_request_operation_processing_queue() { success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id propertyList))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id propertyList))failure { - AFPropertyListRequestOperation *requestOperation = [[[self alloc] initWithRequest:request] autorelease]; + AFPropertyListRequestOperation *requestOperation = [[self alloc] initWithRequest:request]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if (success) { success(operation.request, operation.response, responseObject); @@ -72,11 +72,6 @@ static dispatch_queue_t property_list_request_operation_processing_queue() { return self; } -- (void)dealloc { - [_responsePropertyList release]; - [_propertyListError release]; - [super dealloc]; -} - (id)responsePropertyList { if (!_responsePropertyList && [self.responseData length] > 0 && [self isFinished]) { @@ -111,31 +106,32 @@ static dispatch_queue_t property_list_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { + __weak AFPropertyListRequestOperation *weakSelf = self; self.completionBlock = ^ { - if ([self isCancelled]) { + if ([weakSelf isCancelled]) { return; } - if (self.error) { + if (weakSelf.error) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { dispatch_async(property_list_request_operation_processing_queue(), ^(void) { - id propertyList = self.responsePropertyList; + id propertyList = weakSelf.responsePropertyList; if (self.propertyListError) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { if (success) { - dispatch_async(self.successCallbackQueue ? self.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(self, propertyList); + dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ + success(weakSelf, propertyList); }); } } diff --git a/AFNetworking/AFURLConnectionOperation.h b/AFNetworking/AFURLConnectionOperation.h index 0da353a..5879526 100644 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/AFNetworking/AFURLConnectionOperation.h @@ -84,7 +84,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; /** The run loop modes in which the operation will run on the network thread. By default, this is a single-member set containing `NSRunLoopCommonModes`. */ -@property (nonatomic, retain) NSSet *runLoopModes; +@property (nonatomic) NSSet *runLoopModes; ///----------------------------------------- /// @name Getting URL Connection Information @@ -93,17 +93,17 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; /** The request used by the operation's connection. */ -@property (readonly, nonatomic, retain) NSURLRequest *request; +@property (readonly, nonatomic, strong) NSURLRequest *request; /** The last response received by the operation's connection. */ -@property (readonly, nonatomic, retain) NSURLResponse *response; +@property (readonly, nonatomic, strong) NSURLResponse *response; /** The error, if any, that occured in the lifecycle of the request. */ -@property (readonly, nonatomic, retain) NSError *error; +@property (readonly, nonatomic, strong) NSError *error; ///---------------------------- /// @name Getting Response Data @@ -112,7 +112,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; /** The data received during the request. */ -@property (readonly, nonatomic, retain) NSData *responseData; +@property (readonly, nonatomic, strong) NSData *responseData; /** The string representation of the response data. @@ -130,14 +130,14 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; @discussion This property acts as a proxy to the `HTTPBodyStream` property of `request`. */ -@property (nonatomic, retain) NSInputStream *inputStream; +@property (nonatomic) NSInputStream *inputStream; /** The output stream that is used to write data received until the request is finished. @discussion By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set. */ -@property (nonatomic, retain) NSOutputStream *outputStream; +@property (nonatomic) NSOutputStream *outputStream; ///------------------------------------------------------ /// @name Initializing an AFURLConnectionOperation Object diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 9686580..936a2d2 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -103,12 +103,12 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat @interface AFURLConnectionOperation () @property (readwrite, nonatomic, assign) AFOperationState state; @property (readwrite, nonatomic, assign, getter = isCancelled) BOOL cancelled; -@property (readwrite, nonatomic, retain) NSRecursiveLock *lock; -@property (readwrite, nonatomic, retain) NSURLConnection *connection; -@property (readwrite, nonatomic, retain) NSURLRequest *request; -@property (readwrite, nonatomic, retain) NSURLResponse *response; -@property (readwrite, nonatomic, retain) NSError *error; -@property (readwrite, nonatomic, retain) NSData *responseData; +@property (readwrite, nonatomic, strong) NSRecursiveLock *lock; +@property (readwrite, nonatomic, strong) NSURLConnection *connection; +@property (readwrite, nonatomic, strong) NSURLRequest *request; +@property (readwrite, nonatomic, strong) NSURLResponse *response; +@property (readwrite, nonatomic, strong) NSError *error; +@property (readwrite, nonatomic, strong) NSData *responseData; @property (readwrite, nonatomic, copy) NSString *responseString; @property (readwrite, nonatomic, assign) long long totalBytesRead; @property (readwrite, nonatomic, assign) AFBackgroundTaskIdentifier backgroundTaskIdentifier; @@ -147,9 +147,9 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat + (void)networkRequestThreadEntryPoint:(id)__unused object { do { - NSAutoreleasePool *runLoopPool = [[NSAutoreleasePool alloc] init]; - [[NSRunLoop currentRunLoop] run]; - [runLoopPool drain]; + @autoreleasepool { + [[NSRunLoop currentRunLoop] run]; + } } while (YES); } @@ -171,7 +171,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat return nil; } - self.lock = [[[NSRecursiveLock alloc] init] autorelease]; + self.lock = [[NSRecursiveLock alloc] init]; self.lock.name = kAFNetworkingLockName; self.runLoopModes = [NSSet setWithObject:NSRunLoopCommonModes]; @@ -186,20 +186,12 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat } - (void)dealloc { - [_lock release]; - [_runLoopModes release]; - [_request release]; - [_response release]; - [_error release]; - [_responseData release]; - [_responseString release]; if (_outputStream) { [_outputStream close]; - [_outputStream release]; _outputStream = nil; } @@ -210,16 +202,8 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat } #endif - [_uploadProgress release]; - [_downloadProgress release]; - [_authenticationChallenge release]; - [_authenticationAgainstProtectionSpace release]; - [_cacheResponse release]; - [_redirectResponse release]; - [_connection release]; - [super dealloc]; } - (NSString *)description { @@ -231,7 +215,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat if (!block) { [super setCompletionBlock:nil]; } else { - __block id _blockSelf = self; + __unsafe_unretained id _blockSelf = self; [super setCompletionBlock:^ { block(); [_blockSelf setCompletionBlock:nil]; @@ -246,7 +230,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat - (void)setInputStream:(NSInputStream *)inputStream { [self willChangeValueForKey:@"inputStream"]; - NSMutableURLRequest *mutableRequest = [[self.request mutableCopy] autorelease]; + NSMutableURLRequest *mutableRequest = [self.request mutableCopy]; mutableRequest.HTTPBodyStream = inputStream; self.request = mutableRequest; [self didChangeValueForKey:@"inputStream"]; @@ -254,11 +238,9 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat - (void)setOutputStream:(NSOutputStream *)outputStream { [self willChangeValueForKey:@"outputStream"]; - [outputStream retain]; if (_outputStream) { [_outputStream close]; - [_outputStream release]; } _outputStream = outputStream; [self didChangeValueForKey:@"outputStream"]; @@ -344,10 +326,10 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat if (!_responseString && self.response && self.responseData) { NSStringEncoding textEncoding = NSUTF8StringEncoding; if (self.response.textEncodingName) { - textEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef)self.response.textEncodingName)); + textEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((__bridge CFStringRef)self.response.textEncodingName)); } - self.responseString = [[[NSString alloc] initWithData:self.responseData encoding:textEncoding] autorelease]; + self.responseString = [[NSString alloc] initWithData:self.responseData encoding:textEncoding]; } [self.lock unlock]; @@ -416,7 +398,7 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat if ([self isCancelled]) { [self finish]; } else { - self.connection = [[[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO] autorelease]; + self.connection = [[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; for (NSString *runLoopMode in self.runLoopModes) { @@ -496,8 +478,8 @@ didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge if ([challenge previousFailureCount] == 0) { NSURLCredential *credential = nil; - NSString *username = [(NSString *)CFURLCopyUserName((CFURLRef)[self.request URL]) autorelease]; - NSString *password = [(NSString *)CFURLCopyPassword((CFURLRef)[self.request URL]) autorelease]; + NSString *username = (__bridge_transfer NSString *)CFURLCopyUserName((__bridge CFURLRef)[self.request URL]); + NSString *password = (__bridge_transfer NSString *)CFURLCopyPassword((__bridge CFURLRef)[self.request URL]); if (username && password) { credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone]; diff --git a/AFNetworking/AFXMLRequestOperation.h b/AFNetworking/AFXMLRequestOperation.h index 0beb677..ca16d42 100644 --- a/AFNetworking/AFXMLRequestOperation.h +++ b/AFNetworking/AFXMLRequestOperation.h @@ -48,7 +48,7 @@ /** An `NSXMLParser` object constructed from the response data. */ -@property (readonly, nonatomic, retain) NSXMLParser *responseXMLParser; +@property (readonly, nonatomic) NSXMLParser *responseXMLParser; #if __MAC_OS_X_VERSION_MIN_REQUIRED /** diff --git a/AFNetworking/AFXMLRequestOperation.m b/AFNetworking/AFXMLRequestOperation.m index f40cacb..dbc62a1 100644 --- a/AFNetworking/AFXMLRequestOperation.m +++ b/AFNetworking/AFXMLRequestOperation.m @@ -34,11 +34,11 @@ static dispatch_queue_t xml_request_operation_processing_queue() { } @interface AFXMLRequestOperation () -@property (readwrite, nonatomic, retain) NSXMLParser *responseXMLParser; +@property (readwrite, nonatomic) NSXMLParser *responseXMLParser; #if __MAC_OS_X_VERSION_MIN_REQUIRED @property (readwrite, nonatomic, retain) NSXMLDocument *responseXMLDocument; #endif -@property (readwrite, nonatomic, retain) NSError *XMLError; +@property (readwrite, nonatomic) NSError *XMLError; @end @implementation AFXMLRequestOperation @@ -52,7 +52,7 @@ static dispatch_queue_t xml_request_operation_processing_queue() { success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLParser *XMLParser))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLParser *XMLParser))failure { - AFXMLRequestOperation *requestOperation = [[[self alloc] initWithRequest:urlRequest] autorelease]; + AFXMLRequestOperation *requestOperation = [[self alloc] initWithRequest:urlRequest]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if (success) { success(operation.request, operation.response, responseObject); @@ -71,7 +71,7 @@ static dispatch_queue_t xml_request_operation_processing_queue() { success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLDocument *document))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLDocument *document))failure { - AFXMLRequestOperation *requestOperation = [[[self alloc] initWithRequest:urlRequest] autorelease]; + AFXMLRequestOperation *requestOperation = [[self alloc] initWithRequest:urlRequest]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, __unused id responseObject) { if (success) { NSXMLDocument *XMLDocument = [(AFXMLRequestOperation *)operation responseXMLDocument]; @@ -88,21 +88,10 @@ static dispatch_queue_t xml_request_operation_processing_queue() { } #endif -- (void)dealloc { - [_responseXMLParser release]; - -#if __MAC_OS_X_VERSION_MIN_REQUIRED - [_responseXMLDocument release]; -#endif - - [_XMLError release]; - - [super dealloc]; -} - (NSXMLParser *)responseXMLParser { if (!_responseXMLParser && [self.responseData length] > 0 && [self isFinished]) { - self.responseXMLParser = [[[NSXMLParser alloc] initWithData:self.responseData] autorelease]; + self.responseXMLParser = [[NSXMLParser alloc] initWithData:self.responseData]; } return _responseXMLParser; @@ -112,7 +101,7 @@ static dispatch_queue_t xml_request_operation_processing_queue() { - (NSXMLDocument *)responseXMLDocument { if (!_responseXMLDocument && [self.responseData length] > 0 && [self isFinished]) { NSError *error = nil; - self.responseXMLDocument = [[[NSXMLDocument alloc] initWithData:self.responseData options:0 error:&error] autorelease]; + self.responseXMLDocument = [[NSXMLDocument alloc] initWithData:self.responseData options:0 error:&error]; self.XMLError = error; } @@ -149,24 +138,25 @@ static dispatch_queue_t xml_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { + __weak AFXMLRequestOperation *weakSelf = self; self.completionBlock = ^ { - if ([self isCancelled]) { + if ([weakSelf isCancelled]) { return; } dispatch_async(xml_request_operation_processing_queue(), ^(void) { - NSXMLParser *XMLParser = self.responseXMLParser; + NSXMLParser *XMLParser = weakSelf.responseXMLParser; if (self.error) { if (failure) { - dispatch_async(self.failureCallbackQueue ? self.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(self, self.error); + dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ + failure(weakSelf, weakSelf.error); }); } } else { if (success) { - dispatch_async(self.successCallbackQueue ? self.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(self, XMLParser); + dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ + success(weakSelf, XMLParser); }); } } diff --git a/AFNetworking/UIImageView+AFNetworking.m b/AFNetworking/UIImageView+AFNetworking.m index ac1f708..d694c35 100644 --- a/AFNetworking/UIImageView+AFNetworking.m +++ b/AFNetworking/UIImageView+AFNetworking.m @@ -111,7 +111,7 @@ static char kAFImageRequestOperationObjectKey; } else { self.image = placeholderImage; - AFImageRequestOperation *requestOperation = [[[AFImageRequestOperation alloc] initWithRequest:urlRequest] autorelease]; + AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { if ([[urlRequest URL] isEqual:[[self.af_imageRequestOperation request] URL]]) { self.image = responseObject; diff --git a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj index e537260..e3a71f2 100644 --- a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj @@ -11,18 +11,16 @@ F8129C321591073C009BFE23 /* AFTwitterAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C251591073C009BFE23 /* AFTwitterAPIClient.m */; }; F8129C341591073C009BFE23 /* Tweet.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C2B1591073C009BFE23 /* Tweet.m */; }; F8129C351591073C009BFE23 /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C2D1591073C009BFE23 /* User.m */; }; - F8129C631591090B009BFE23 /* AFHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C4F1591090B009BFE23 /* AFHTTPClient.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C641591090B009BFE23 /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C511591090B009BFE23 /* AFHTTPRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C651591090B009BFE23 /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C531591090B009BFE23 /* AFImageRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C661591090B009BFE23 /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C551591090B009BFE23 /* AFJSONRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C681591090B009BFE23 /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C591591090B009BFE23 /* AFNetworkActivityIndicatorManager.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C691591090B009BFE23 /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C5C1591090B009BFE23 /* AFPropertyListRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C6A1591090B009BFE23 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C5E1591090B009BFE23 /* AFURLConnectionOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C6B1591090B009BFE23 /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C601591090B009BFE23 /* AFXMLRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8129C6C1591090B009BFE23 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C621591090B009BFE23 /* UIImageView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; F8129C6F15910B15009BFE23 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C6E15910B15009BFE23 /* main.m */; }; F8129C7115910B3E009BFE23 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = F8129C7015910B3E009BFE23 /* MainMenu.xib */; }; F8129C7715910C40009BFE23 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = F8129C7515910C40009BFE23 /* AppDelegate.m */; }; + F82EB07C159A172000B10B56 /* AFHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB06E159A172000B10B56 /* AFHTTPClient.m */; }; + F82EB07D159A172000B10B56 /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB070159A172000B10B56 /* AFHTTPRequestOperation.m */; }; + F82EB07E159A172000B10B56 /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB072159A172000B10B56 /* AFImageRequestOperation.m */; }; + F82EB07F159A172000B10B56 /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB074159A172000B10B56 /* AFJSONRequestOperation.m */; }; + F82EB080159A172000B10B56 /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB077159A172000B10B56 /* AFPropertyListRequestOperation.m */; }; + F82EB081159A172000B10B56 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB079159A172000B10B56 /* AFURLConnectionOperation.m */; }; + F82EB082159A172000B10B56 /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F82EB07B159A172000B10B56 /* AFXMLRequestOperation.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -37,29 +35,25 @@ F8129C2C1591073C009BFE23 /* User.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = User.h; sourceTree = ""; }; F8129C2D1591073C009BFE23 /* User.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = User.m; sourceTree = ""; }; F8129C311591073C009BFE23 /* AFTwitterAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFTwitterAPIClient.h; path = Classes/AFTwitterAPIClient.h; sourceTree = SOURCE_ROOT; }; - F8129C4E1591090B009BFE23 /* AFHTTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFHTTPClient.h; path = ../AFNetworking/AFHTTPClient.h; sourceTree = ""; }; - F8129C4F1591090B009BFE23 /* AFHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFHTTPClient.m; path = ../AFNetworking/AFHTTPClient.m; sourceTree = ""; }; - F8129C501591090B009BFE23 /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFHTTPRequestOperation.h; path = ../AFNetworking/AFHTTPRequestOperation.h; sourceTree = ""; }; - F8129C511591090B009BFE23 /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFHTTPRequestOperation.m; path = ../AFNetworking/AFHTTPRequestOperation.m; sourceTree = ""; }; - F8129C521591090B009BFE23 /* AFImageRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFImageRequestOperation.h; path = ../AFNetworking/AFImageRequestOperation.h; sourceTree = ""; }; - F8129C531591090B009BFE23 /* AFImageRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFImageRequestOperation.m; path = ../AFNetworking/AFImageRequestOperation.m; sourceTree = ""; }; - F8129C541591090B009BFE23 /* AFJSONRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFJSONRequestOperation.h; path = ../AFNetworking/AFJSONRequestOperation.h; sourceTree = ""; }; - F8129C551591090B009BFE23 /* AFJSONRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFJSONRequestOperation.m; path = ../AFNetworking/AFJSONRequestOperation.m; sourceTree = ""; }; - F8129C581591090B009BFE23 /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworkActivityIndicatorManager.h; path = ../AFNetworking/AFNetworkActivityIndicatorManager.h; sourceTree = ""; }; - F8129C591591090B009BFE23 /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFNetworkActivityIndicatorManager.m; path = ../AFNetworking/AFNetworkActivityIndicatorManager.m; sourceTree = ""; }; - F8129C5A1591090B009BFE23 /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = ../AFNetworking/AFNetworking.h; sourceTree = ""; }; - F8129C5B1591090B009BFE23 /* AFPropertyListRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFPropertyListRequestOperation.h; path = ../AFNetworking/AFPropertyListRequestOperation.h; sourceTree = ""; }; - F8129C5C1591090B009BFE23 /* AFPropertyListRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFPropertyListRequestOperation.m; path = ../AFNetworking/AFPropertyListRequestOperation.m; sourceTree = ""; }; - F8129C5D1591090B009BFE23 /* AFURLConnectionOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFURLConnectionOperation.h; path = ../AFNetworking/AFURLConnectionOperation.h; sourceTree = ""; }; - F8129C5E1591090B009BFE23 /* AFURLConnectionOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFURLConnectionOperation.m; path = ../AFNetworking/AFURLConnectionOperation.m; sourceTree = ""; }; - F8129C5F1591090B009BFE23 /* AFXMLRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFXMLRequestOperation.h; path = ../AFNetworking/AFXMLRequestOperation.h; sourceTree = ""; }; - F8129C601591090B009BFE23 /* AFXMLRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFXMLRequestOperation.m; path = ../AFNetworking/AFXMLRequestOperation.m; sourceTree = ""; }; - F8129C611591090B009BFE23 /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImageView+AFNetworking.h"; path = "../AFNetworking/UIImageView+AFNetworking.h"; sourceTree = ""; }; - F8129C621591090B009BFE23 /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+AFNetworking.m"; path = "../AFNetworking/UIImageView+AFNetworking.m"; sourceTree = ""; }; F8129C6E15910B15009BFE23 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; F8129C7015910B3E009BFE23 /* MainMenu.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenu.xib; sourceTree = SOURCE_ROOT; }; F8129C7515910C40009BFE23 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = SOURCE_ROOT; }; F8129C7615910C40009BFE23 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; }; + F82EB06D159A172000B10B56 /* AFHTTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFHTTPClient.h; path = ../AFNetworking/AFHTTPClient.h; sourceTree = ""; }; + F82EB06E159A172000B10B56 /* AFHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFHTTPClient.m; path = ../AFNetworking/AFHTTPClient.m; sourceTree = ""; }; + F82EB06F159A172000B10B56 /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFHTTPRequestOperation.h; path = ../AFNetworking/AFHTTPRequestOperation.h; sourceTree = ""; }; + F82EB070159A172000B10B56 /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFHTTPRequestOperation.m; path = ../AFNetworking/AFHTTPRequestOperation.m; sourceTree = ""; }; + F82EB071159A172000B10B56 /* AFImageRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFImageRequestOperation.h; path = ../AFNetworking/AFImageRequestOperation.h; sourceTree = ""; }; + F82EB072159A172000B10B56 /* AFImageRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFImageRequestOperation.m; path = ../AFNetworking/AFImageRequestOperation.m; sourceTree = ""; }; + F82EB073159A172000B10B56 /* AFJSONRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFJSONRequestOperation.h; path = ../AFNetworking/AFJSONRequestOperation.h; sourceTree = ""; }; + F82EB074159A172000B10B56 /* AFJSONRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFJSONRequestOperation.m; path = ../AFNetworking/AFJSONRequestOperation.m; sourceTree = ""; }; + F82EB075159A172000B10B56 /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = ../AFNetworking/AFNetworking.h; sourceTree = ""; }; + F82EB076159A172000B10B56 /* AFPropertyListRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFPropertyListRequestOperation.h; path = ../AFNetworking/AFPropertyListRequestOperation.h; sourceTree = ""; }; + F82EB077159A172000B10B56 /* AFPropertyListRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFPropertyListRequestOperation.m; path = ../AFNetworking/AFPropertyListRequestOperation.m; sourceTree = ""; }; + F82EB078159A172000B10B56 /* AFURLConnectionOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFURLConnectionOperation.h; path = ../AFNetworking/AFURLConnectionOperation.h; sourceTree = ""; }; + F82EB079159A172000B10B56 /* AFURLConnectionOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFURLConnectionOperation.m; path = ../AFNetworking/AFURLConnectionOperation.m; sourceTree = ""; }; + F82EB07A159A172000B10B56 /* AFXMLRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFXMLRequestOperation.h; path = ../AFNetworking/AFXMLRequestOperation.h; sourceTree = ""; }; + F82EB07B159A172000B10B56 /* AFXMLRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFXMLRequestOperation.m; path = ../AFNetworking/AFXMLRequestOperation.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -149,29 +143,33 @@ F8129C4C15910901009BFE23 /* Vendor */ = { isa = PBXGroup; children = ( - F8129C4E1591090B009BFE23 /* AFHTTPClient.h */, - F8129C4F1591090B009BFE23 /* AFHTTPClient.m */, - F8129C501591090B009BFE23 /* AFHTTPRequestOperation.h */, - F8129C511591090B009BFE23 /* AFHTTPRequestOperation.m */, - F8129C521591090B009BFE23 /* AFImageRequestOperation.h */, - F8129C531591090B009BFE23 /* AFImageRequestOperation.m */, - F8129C541591090B009BFE23 /* AFJSONRequestOperation.h */, - F8129C551591090B009BFE23 /* AFJSONRequestOperation.m */, - F8129C581591090B009BFE23 /* AFNetworkActivityIndicatorManager.h */, - F8129C591591090B009BFE23 /* AFNetworkActivityIndicatorManager.m */, - F8129C5A1591090B009BFE23 /* AFNetworking.h */, - F8129C5B1591090B009BFE23 /* AFPropertyListRequestOperation.h */, - F8129C5C1591090B009BFE23 /* AFPropertyListRequestOperation.m */, - F8129C5D1591090B009BFE23 /* AFURLConnectionOperation.h */, - F8129C5E1591090B009BFE23 /* AFURLConnectionOperation.m */, - F8129C5F1591090B009BFE23 /* AFXMLRequestOperation.h */, - F8129C601591090B009BFE23 /* AFXMLRequestOperation.m */, - F8129C611591090B009BFE23 /* UIImageView+AFNetworking.h */, - F8129C621591090B009BFE23 /* UIImageView+AFNetworking.m */, + F82EB083159A172500B10B56 /* AFNetworking */, ); name = Vendor; sourceTree = ""; }; + F82EB083159A172500B10B56 /* AFNetworking */ = { + isa = PBXGroup; + children = ( + F82EB06D159A172000B10B56 /* AFHTTPClient.h */, + F82EB06E159A172000B10B56 /* AFHTTPClient.m */, + F82EB06F159A172000B10B56 /* AFHTTPRequestOperation.h */, + F82EB070159A172000B10B56 /* AFHTTPRequestOperation.m */, + F82EB071159A172000B10B56 /* AFImageRequestOperation.h */, + F82EB072159A172000B10B56 /* AFImageRequestOperation.m */, + F82EB073159A172000B10B56 /* AFJSONRequestOperation.h */, + F82EB074159A172000B10B56 /* AFJSONRequestOperation.m */, + F82EB075159A172000B10B56 /* AFNetworking.h */, + F82EB076159A172000B10B56 /* AFPropertyListRequestOperation.h */, + F82EB077159A172000B10B56 /* AFPropertyListRequestOperation.m */, + F82EB078159A172000B10B56 /* AFURLConnectionOperation.h */, + F82EB079159A172000B10B56 /* AFURLConnectionOperation.m */, + F82EB07A159A172000B10B56 /* AFXMLRequestOperation.h */, + F82EB07B159A172000B10B56 /* AFXMLRequestOperation.m */, + ); + name = AFNetworking; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -236,17 +234,15 @@ F8129C341591073C009BFE23 /* Tweet.m in Sources */, F8129C351591073C009BFE23 /* User.m in Sources */, F8129C321591073C009BFE23 /* AFTwitterAPIClient.m in Sources */, - F8129C631591090B009BFE23 /* AFHTTPClient.m in Sources */, - F8129C641591090B009BFE23 /* AFHTTPRequestOperation.m in Sources */, - F8129C651591090B009BFE23 /* AFImageRequestOperation.m in Sources */, - F8129C661591090B009BFE23 /* AFJSONRequestOperation.m in Sources */, - F8129C681591090B009BFE23 /* AFNetworkActivityIndicatorManager.m in Sources */, - F8129C691591090B009BFE23 /* AFPropertyListRequestOperation.m in Sources */, - F8129C6A1591090B009BFE23 /* AFURLConnectionOperation.m in Sources */, - F8129C6B1591090B009BFE23 /* AFXMLRequestOperation.m in Sources */, - F8129C6C1591090B009BFE23 /* UIImageView+AFNetworking.m in Sources */, F8129C6F15910B15009BFE23 /* main.m in Sources */, F8129C7715910C40009BFE23 /* AppDelegate.m in Sources */, + F82EB07C159A172000B10B56 /* AFHTTPClient.m in Sources */, + F82EB07D159A172000B10B56 /* AFHTTPRequestOperation.m in Sources */, + F82EB07E159A172000B10B56 /* AFImageRequestOperation.m in Sources */, + F82EB07F159A172000B10B56 /* AFJSONRequestOperation.m in Sources */, + F82EB080159A172000B10B56 /* AFPropertyListRequestOperation.m in Sources */, + F82EB081159A172000B10B56 /* AFURLConnectionOperation.m in Sources */, + F82EB082159A172000B10B56 /* AFXMLRequestOperation.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj index 39e7fc7..987dfbf 100644 --- a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj @@ -23,15 +23,15 @@ F8FA9494150EF97E00ED4EAD /* Tweet.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA9493150EF97E00ED4EAD /* Tweet.m */; }; F8FA9497150EF98800ED4EAD /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA9496150EF98800ED4EAD /* User.m */; }; F8FA949A150EF9DA00ED4EAD /* PublicTimelineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA9499150EF9DA00ED4EAD /* PublicTimelineViewController.m */; }; - F8FA94B1150EFEC100ED4EAD /* AFHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA949D150EFEC100ED4EAD /* AFHTTPClient.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B2150EFEC100ED4EAD /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA949F150EFEC100ED4EAD /* AFHTTPRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B3150EFEC100ED4EAD /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A1150EFEC100ED4EAD /* AFImageRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B4150EFEC100ED4EAD /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A3150EFEC100ED4EAD /* AFJSONRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B6150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A7150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B7150EFEC100ED4EAD /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AA150EFEC100ED4EAD /* AFPropertyListRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B8150EFEC100ED4EAD /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AC150EFEC100ED4EAD /* AFURLConnectionOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94B9150EFEC100ED4EAD /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AE150EFEC100ED4EAD /* AFXMLRequestOperation.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; - F8FA94BA150EFEC100ED4EAD /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94B0150EFEC100ED4EAD /* UIImageView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; + F8FA94B1150EFEC100ED4EAD /* AFHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA949D150EFEC100ED4EAD /* AFHTTPClient.m */; }; + F8FA94B2150EFEC100ED4EAD /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA949F150EFEC100ED4EAD /* AFHTTPRequestOperation.m */; }; + F8FA94B3150EFEC100ED4EAD /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A1150EFEC100ED4EAD /* AFImageRequestOperation.m */; }; + F8FA94B4150EFEC100ED4EAD /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A3150EFEC100ED4EAD /* AFJSONRequestOperation.m */; }; + F8FA94B6150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94A7150EFEC100ED4EAD /* AFNetworkActivityIndicatorManager.m */; }; + F8FA94B7150EFEC100ED4EAD /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AA150EFEC100ED4EAD /* AFPropertyListRequestOperation.m */; }; + F8FA94B8150EFEC100ED4EAD /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AC150EFEC100ED4EAD /* AFURLConnectionOperation.m */; }; + F8FA94B9150EFEC100ED4EAD /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94AE150EFEC100ED4EAD /* AFXMLRequestOperation.m */; }; + F8FA94BA150EFEC100ED4EAD /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94B0150EFEC100ED4EAD /* UIImageView+AFNetworking.m */; }; F8FA94C1150F019100ED4EAD /* TweetTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F8FA94C0150F019100ED4EAD /* TweetTableViewCell.m */; }; F8FA94D0150F094D00ED4EAD /* profile-image-placeholder.png in Resources */ = {isa = PBXBuildFile; fileRef = F8FA94CC150F094D00ED4EAD /* profile-image-placeholder.png */; }; F8FA94D1150F094D00ED4EAD /* profile-image-placeholder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F8FA94CD150F094D00ED4EAD /* profile-image-placeholder@2x.png */; }; diff --git a/Example/AppDelegate.h b/Example/AppDelegate.h index 0241509..bc25a4b 100644 --- a/Example/AppDelegate.h +++ b/Example/AppDelegate.h @@ -42,7 +42,7 @@ @interface AppDelegate : NSObject @property (strong) IBOutlet NSWindow *window; -@property (weak) IBOutlet NSTableView *tableView; +@property (strong) IBOutlet NSTableView *tableView; @property (strong) IBOutlet NSArrayController *tweetsArrayController; @end diff --git a/Example/Classes/Models/Tweet.h b/Example/Classes/Models/Tweet.h index a08fd3c..9954a2b 100644 --- a/Example/Classes/Models/Tweet.h +++ b/Example/Classes/Models/Tweet.h @@ -26,10 +26,10 @@ @interface Tweet : NSObject -@property (readonly) NSUInteger tweetID; -@property (readonly) NSString *text; +@property (readonly, assign) NSUInteger tweetID; +@property (readonly, strong) NSString *text; -@property (readonly) User *user; +@property (readonly, strong) User *user; - (id)initWithAttributes:(NSDictionary *)attributes; diff --git a/Example/Classes/Models/Tweet.m b/Example/Classes/Models/Tweet.m index 14fe2d0..683e25e 100644 --- a/Example/Classes/Models/Tweet.m +++ b/Example/Classes/Models/Tweet.m @@ -25,13 +25,7 @@ #import "AFTwitterAPIClient.h" -@implementation Tweet { -@private - NSUInteger _tweetID; - __strong NSString *_text; - __strong User *_user; -} - +@implementation Tweet @synthesize tweetID = _tweetID; @synthesize text = _text; @synthesize user = _user; diff --git a/Example/Classes/Models/User.h b/Example/Classes/Models/User.h index f3ea855..25419ef 100644 --- a/Example/Classes/Models/User.h +++ b/Example/Classes/Models/User.h @@ -27,7 +27,7 @@ extern NSString * const kUserProfileImageDidLoadNotification; @interface User : NSObject @property (readonly) NSUInteger userID; -@property (readonly) NSString *username; +@property (strong, readonly) NSString *username; @property (unsafe_unretained, readonly) NSURL *profileImageURL; - (id)initWithAttributes:(NSDictionary *)attributes; From 605bbf1c28200e20f08273aafe95bf0c43ac41fd Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:20:57 -0700 Subject: [PATCH 05/24] [Issue #387] AFHTTPClient should setHTTPShouldHandleCookies:NO by default for requestWithMethod:path:parameters --- AFNetworking/AFHTTPClient.m | 1 + 1 file changed, 1 insertion(+) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 5040059..3bf0c11 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -435,6 +435,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; [request setHTTPMethod:method]; [request setAllHTTPHeaderFields:self.defaultHeaders]; + [request setHTTPShouldHandleCookies:NO]; if ([method isEqualToString:@"GET"] || [method isEqualToString:@"HEAD"]) { [request setHTTPShouldUsePipelining:YES]; From ea94ea6ffa66a9db3743e348cd39807bcf0c8fe8 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:34:08 -0700 Subject: [PATCH 06/24] Revert 25620fe8391183adf7ed15ebdd8c15e8802e95c6 --- AFNetworking/AFHTTPRequestOperation.m | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index fea0235..7537815 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -54,11 +54,10 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) { return [NSSet setWithSet:mutableContentTypes]; } -static void AFSwizzleClassMethodWithImplementation(Class klass, SEL selector, IMP implementation) { +static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, void *block) { Method originalMethod = class_getClassMethod(klass, selector); - if (method_getImplementation(originalMethod) != implementation) { - class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod)); - } + IMP implementation = imp_implementationWithBlock(block); + class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod)); } static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) { @@ -259,10 +258,6 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { #pragma mark - AFHTTPRequestOperation -static id AFStaticClassValueImplementation(id self, SEL _cmd) { - return objc_getAssociatedObject([self class], _cmd); -} - + (NSIndexSet *)acceptableStatusCodes { return [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; } @@ -270,9 +265,9 @@ static id AFStaticClassValueImplementation(id self, SEL _cmd) { + (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes { NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]]; [mutableStatusCodes addIndexes:statusCodes]; - SEL selector = @selector(acceptableStatusCodes); - AFSwizzleClassMethodWithImplementation([self class], selector, (IMP)AFStaticClassValueImplementation); - objc_setAssociatedObject([self class], selector, mutableStatusCodes, OBJC_ASSOCIATION_COPY_NONATOMIC); + AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), (__bridge void *)^(id _self) { + return mutableStatusCodes; + }); } + (NSSet *)acceptableContentTypes { @@ -282,9 +277,9 @@ static id AFStaticClassValueImplementation(id self, SEL _cmd) { + (void)addAcceptableContentTypes:(NSSet *)contentTypes { NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES]; [mutableContentTypes unionSet:contentTypes]; - SEL selector = @selector(acceptableContentTypes); - AFSwizzleClassMethodWithImplementation([self class], selector, (IMP)AFStaticClassValueImplementation); - objc_setAssociatedObject([self class], selector, mutableContentTypes, OBJC_ASSOCIATION_COPY_NONATOMIC); + AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), (__bridge void *)^(id _self) { + return mutableContentTypes; + }); } + (BOOL)canProcessRequest:(NSURLRequest *)request { From c6ffce05b9dfe109ed9e914aeaf2cb52d5fc1d76 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:35:43 -0700 Subject: [PATCH 07/24] Reorganizing vendor directory --- .../project.pbxproj | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj index e3a71f2..fd5b94b 100644 --- a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj @@ -151,21 +151,21 @@ F82EB083159A172500B10B56 /* AFNetworking */ = { isa = PBXGroup; children = ( - F82EB06D159A172000B10B56 /* AFHTTPClient.h */, - F82EB06E159A172000B10B56 /* AFHTTPClient.m */, - F82EB06F159A172000B10B56 /* AFHTTPRequestOperation.h */, - F82EB070159A172000B10B56 /* AFHTTPRequestOperation.m */, - F82EB071159A172000B10B56 /* AFImageRequestOperation.h */, - F82EB072159A172000B10B56 /* AFImageRequestOperation.m */, - F82EB073159A172000B10B56 /* AFJSONRequestOperation.h */, - F82EB074159A172000B10B56 /* AFJSONRequestOperation.m */, F82EB075159A172000B10B56 /* AFNetworking.h */, - F82EB076159A172000B10B56 /* AFPropertyListRequestOperation.h */, - F82EB077159A172000B10B56 /* AFPropertyListRequestOperation.m */, F82EB078159A172000B10B56 /* AFURLConnectionOperation.h */, F82EB079159A172000B10B56 /* AFURLConnectionOperation.m */, + F82EB06F159A172000B10B56 /* AFHTTPRequestOperation.h */, + F82EB070159A172000B10B56 /* AFHTTPRequestOperation.m */, + F82EB073159A172000B10B56 /* AFJSONRequestOperation.h */, + F82EB074159A172000B10B56 /* AFJSONRequestOperation.m */, F82EB07A159A172000B10B56 /* AFXMLRequestOperation.h */, F82EB07B159A172000B10B56 /* AFXMLRequestOperation.m */, + F82EB076159A172000B10B56 /* AFPropertyListRequestOperation.h */, + F82EB077159A172000B10B56 /* AFPropertyListRequestOperation.m */, + F82EB06D159A172000B10B56 /* AFHTTPClient.h */, + F82EB06E159A172000B10B56 /* AFHTTPClient.m */, + F82EB071159A172000B10B56 /* AFImageRequestOperation.h */, + F82EB072159A172000B10B56 /* AFImageRequestOperation.m */, ); name = AFNetworking; sourceTree = ""; From 97900fcbfa8226877e87f16fc8b05b5e884ef61d Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:37:53 -0700 Subject: [PATCH 08/24] Setting NSURLCache memory and disk capacity to Apple default settings --- Example/AppDelegate.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m index 2e27051..22ea848 100644 --- a/Example/AppDelegate.m +++ b/Example/AppDelegate.m @@ -35,7 +35,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 diskCapacity:1024 * 1024 * 5 diskPath:nil]; + NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil]; [NSURLCache setSharedURLCache:URLCache]; [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; @@ -66,7 +66,7 @@ didFinishLaunchingWithOptions:(NSDictionary *)launchOptions @synthesize tweetsArrayController = _tweetsArrayController; - (void)applicationDidFinishLaunching:(NSNotification *)notification { - NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024 diskCapacity:1024 * 1024 * 5 diskPath:nil]; + NSURLCache *URLCache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 1024 diskCapacity:20 * 1024 * 1024 diskPath:nil]; [NSURLCache setSharedURLCache:URLCache]; [self.window makeKeyAndOrderFront:self]; From 1afba1b6233bd216cb9e9f673f84beb47242be83 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:38:34 -0700 Subject: [PATCH 09/24] Sandboxing Mac Example Application --- Example/AFNetworking Example.entitlements | 12 ++++++++++++ .../project.pbxproj | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 Example/AFNetworking Example.entitlements diff --git a/Example/AFNetworking Example.entitlements b/Example/AFNetworking Example.entitlements new file mode 100644 index 0000000..7a2230d --- /dev/null +++ b/Example/AFNetworking Example.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.network.client + + com.apple.security.network.server + + + diff --git a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj index fd5b94b..899632e 100644 --- a/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking Mac Example.xcodeproj/project.pbxproj @@ -54,6 +54,7 @@ F82EB079159A172000B10B56 /* AFURLConnectionOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFURLConnectionOperation.m; path = ../AFNetworking/AFURLConnectionOperation.m; sourceTree = ""; }; F82EB07A159A172000B10B56 /* AFXMLRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFXMLRequestOperation.h; path = ../AFNetworking/AFXMLRequestOperation.h; sourceTree = ""; }; F82EB07B159A172000B10B56 /* AFXMLRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFXMLRequestOperation.m; path = ../AFNetworking/AFXMLRequestOperation.m; sourceTree = ""; }; + F877018B159A1CE700B45C0D /* AFNetworking Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "AFNetworking Example.entitlements"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -71,6 +72,7 @@ F8129BF01591061B009BFE23 = { isa = PBXGroup; children = ( + F877018B159A1CE700B45C0D /* AFNetworking Example.entitlements */, F8129C051591061B009BFE23 /* Classes */, F8129C4C15910901009BFE23 /* Vendor */, F8129BFE1591061B009BFE23 /* Frameworks */, @@ -299,6 +301,8 @@ F8129C1A1591061B009BFE23 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "AFNetworking Example.entitlements"; + CODE_SIGN_IDENTITY = "Mac Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Prefix.pch; INFOPLIST_FILE = "Mac-Info.plist"; @@ -310,6 +314,8 @@ F8129C1B1591061B009BFE23 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CODE_SIGN_ENTITLEMENTS = "AFNetworking Example.entitlements"; + CODE_SIGN_IDENTITY = "Mac Developer"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = Prefix.pch; INFOPLIST_FILE = "Mac-Info.plist"; From 8bfbcb9b9f72f58fc03dfe2f58dc6532b0b6cfb4 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 09:49:09 -0700 Subject: [PATCH 10/24] Updating iOS icon --- Example/Icon.png | Bin 4828 -> 6547 bytes Example/Icon@2x.png | Bin 13047 -> 10055 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Example/Icon.png b/Example/Icon.png index bb79b6531a75923b330733ea0d25055989edee16..9956cb16fce70efc70e200f8f7c2bfb55b6008a6 100644 GIT binary patch literal 6547 zcmV;E8Eoc>P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0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T>Iu^Iab26HT_}McTc5L?AWfwM~~@qn?OuW;~MSDUILO%8(Y(9 zuJbAeoopiyjWOjUiH6`%+u@R-lqbzglv*Px-~CPKf=8A4o-X7gN3CA$*W^gw7GT0j z)tX9B*|teklYBX?E|AP^f9eZkn1d9%j(gI_-cFUB`!hAGoh@+}gV)=1a_EY$_TruB zTd1?Uyo2L27q9sGQl#Vncj;@_t8(aH54_t>mqk798b6rax~m$@k`PoG$*EamD`YB> z3JzfdB|nQku+9IHA0+QHH+4ODXH6pejsJvM3P>bI2B>hK3X5HNUKSV9&rz&T)z=e1uSw3cMnq5vy85la&L(rEiZQ-Yqp9t-s25zb?5FFeJ|5x zX3v_&GZ$KF_j8t!STHNntnF4_Z#bFYDjo1Nt26dB;xRpF#P7D#zV)3gOXu9`i`Q(E zn=4M|t6Ke9U8+G(o#v!-c={wx;!z1tbj)jY6S$c_`=Jk$LFFmk(CDl@*q1-E6wnX3cdU}RS7kSp(^+0;R=05 z!|=NyG3XVj)Z6m+1C)?D!!J(;Y#Pj`LU)f|4(=TFXe^Gp^sd;Mi(ef(Cp=ko=Sc(d zs+#~-H2T@-%fn#C^#xQxFxS&ycuu*v9kWUd;_%d1;nzNSS^uMVCwT!G4mPY^4ORoc P|2OID7$HlwZifF4$_=(N diff --git a/Example/Icon@2x.png b/Example/Icon@2x.png index b8d01127454d156ad64474809c3719d38a4fb85a..7fcc2264f7d4864cd2d5838d1966981fb9937b54 100644 GIT binary patch delta 7381 zcmV;`94h1YWyemC83+OZ0002L5-PDFo(g{)a!Eu%RCwCteP@_l#g+DZs&42s-IJ3> zVWg3e2tpDP2mwNXY@)yflXq=!0JFCF)>wS7m|)`%j6W}C2{yrCgRxnHvB3r#3|dSM zE3jCEgq5Yqc{=wEb@oTM)YGG$nQk$XMyQ_q%=1j&x^=5goqErEPK8TbpFX$5r=x#> zM7o!Z0O?+m1_>P`L4GReJCl1geQN^2x-FSu;D2v8zet9!EiX%MZPNXmT|l%3j$fO>OPR< zSl4H2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6y}Dsld&M_{ksmER&PdH799eVv>KK_=$go5yO*@e~Y!XRkYR& zdOcoy?Pb3IlRvzPW_+)zmC=!%stu@naU*bqiCEdOpT%7ViK2+9sU7UydsE}NsXf`~ zt>@d)n>dTG@1_Go0qpUKF5?Bae>kW;ndLw&%ZhvKwYAC2#eMoackX7#&fWEAvu$?o z*_UNB;_H8DT-W8qTd#2F&|U0lc-BU*6$K-QKx)g#A>Sp>e^)T<*o71{bmcf=p+U%Yc3dgYrENn7EQ|6Qn5&!?uXA5QZ78N{0iO?2ho*YPHD zQ52z7;(1w?byaQChvQlcwP0CRR$Q%9BqY(bAI{MC$Vl<()Qiplfx%#a>$>#&{SSX< z>3cvLTdh{y-IneySj7^DwT^u_ZY-4w;QM|SX_OY;^?e`D^RO&yTVV5t`0sU~i zzcx{8jpun8gxG|@*_)+Ddc7X5>tcV~HiN<7L+QLus#GbJROSz#|1HIBFc@IlHm>Vt zo^5&8*AK_FkiZn|kD_R#CL Date: Tue, 26 Jun 2012 09:51:21 -0700 Subject: [PATCH 11/24] Updating requirements Removing note about ARC compatibility --- README.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/README.md b/README.md index 9d5fb45..efc226f 100644 --- a/README.md +++ b/README.md @@ -143,20 +143,7 @@ operation.outputStream = [NSOutputStream outputStreamToMemory]; ## Requirements -AFNetworking requires either [iOS 4.0](http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iPhoneOS4.html) and above, or [Mac OS 10.6](http://developer.apple.com/library/mac/#releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html#//apple_ref/doc/uid/TP40008898-SW7) ([64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)) and above. - -AFNetworking uses [`NSJSONSerialization`](http://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html) if it is available. If your app targets a platform where this class is not available you can include one of the following JSON libraries to your project for AFNetworking to automatically detect and use. - -* [JSONKit](https://github.com/johnezang/JSONKit) -* [SBJson](https://stig.github.com/json-framework/) -* [YAJL](https://lloyd.github.com/yajl/) -* [NextiveJson](https://github.com/nextive/NextiveJson) - -### ARC Support - -AFNetworking will transition its codebase to ARC in a future release. - -If you are including AFNetworking in a project that uses [Automatic Reference Counting (ARC)](http://clang.llvm.org/docs/AutomaticReferenceCounting.html) enabled, you will need to set the `-fno-objc-arc` compiler flag on all of the AFNetworking source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. Now select all AFNetworking source files, press Enter, insert `-fno-objc-arc` and then "Done" to disable ARC for AFNetworking. +AFNetworking requires either [iOS 5.0](http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iPhoneOS4.html) and above, or [Mac OS 10.7](http://developer.apple.com/library/mac/#releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html#//apple_ref/doc/uid/TP40008898-SW7) ([64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)) and above. ## Credits From c3d61992979d025da70e2d86c476a5b8b7bafffd Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 10:03:27 -0700 Subject: [PATCH 12/24] Add changes for 1.0RC2 --- CHANGES | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGES b/CHANGES index 60b4cac..ddd730c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,15 @@ += 1.0RC2 / 2012-06-26 + + * AFNetworking now requires iOS 5 / Mac OSX 10.7 or higher (Mattt Thompson) + + * AFNetworking now uses Automatic Reference Counting (ARC) (Mattt Thompson) + + * Revert implementation of `AFHTTPRequestOperation` + `+addAcceptableStatusCodes:` and `+addAcceptableContentTypes:` to use + `class_replaceMethod` with `imp_implementationWithBlock`. (Mattt Thompson) + + * Update icons for iOS example application (Mattt Thompson) + = 0.10.0 / 2012-06-26 * Add Twitter Mac Example application (Mattt Thompson) From 6e4ad945acf5e95efef3a756876b2feae647c887 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 10:05:38 -0700 Subject: [PATCH 13/24] Add Changelog entry for AFHTTPClient requests not handling cookies by default --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index ddd730c..bc7f2a8 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,8 @@ `+addAcceptableStatusCodes:` and `+addAcceptableContentTypes:` to use `class_replaceMethod` with `imp_implementationWithBlock`. (Mattt Thompson) + * Update `AFHTTPClient` to not handle cookies by default (@phamsonha, Mattt Thompson) + * Update icons for iOS example application (Mattt Thompson) = 0.10.0 / 2012-06-26 From 16dc57c1fa7e3c297ae063ae9085e936c22529f9 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 26 Jun 2012 22:15:09 -0700 Subject: [PATCH 14/24] [Issue #388] Make AFURLConnectionOperation conform to NSURLConnectionDelegate and NSURLConnectionDataDelegate --- AFNetworking/AFURLConnectionOperation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFNetworking/AFURLConnectionOperation.h b/AFNetworking/AFURLConnectionOperation.h index 5879526..398a474 100644 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/AFNetworking/AFURLConnectionOperation.h @@ -75,7 +75,7 @@ extern NSString * const AFNetworkingOperationDidFinishNotification; @warning Attempting to load a `file://` URL in iOS 4 may result in an `NSInvalidArgumentException`, caused by the connection returning `NSURLResponse` rather than `NSHTTPURLResponse`, which is the behavior as of iOS 5. */ -@interface AFURLConnectionOperation : NSOperation +@interface AFURLConnectionOperation : NSOperation ///------------------------------- /// @name Accessing Run Loop Modes From 2b2317907e3f4933e1eccbb80a8c9476520bdd54 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Thu, 28 Jun 2012 15:51:27 -0700 Subject: [PATCH 15/24] [Issue #379] Fixing AFHTTPRequestOperation +canProcessRequest: --- AFNetworking/AFHTTPRequestOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 7537815..267d04d 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -283,7 +283,7 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { } + (BOOL)canProcessRequest:(NSURLRequest *)request { - if (![[self class] isEqual:[AFHTTPRequestOperation class]]) { + if ([[self class] isEqual:[AFHTTPRequestOperation class]]) { return YES; } From ae340b19e9bc71aeb064af1dc0a88b5ed6277505 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Tue, 3 Jul 2012 07:20:15 -0700 Subject: [PATCH 16/24] Removing whitespace leftover in dealloc from migration --- AFNetworking/AFHTTPClient.m | 2 -- AFNetworking/AFHTTPRequestOperation.m | 2 -- AFNetworking/AFURLConnectionOperation.m | 7 ------- 3 files changed, 11 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 3bf0c11..1dd08ad 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -283,8 +283,6 @@ static NSString * AFPropertyListStringFromParameters(NSDictionary *parameters) { #ifdef _SYSTEMCONFIGURATION_H [self stopMonitoringNetworkReachability]; #endif - - } - (NSString *)description { diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 267d04d..2927da7 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -128,7 +128,6 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { @dynamic response; - (void)dealloc { - if (_successCallbackQueue) { dispatch_release(_successCallbackQueue); _successCallbackQueue = NULL; @@ -138,7 +137,6 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { dispatch_release(_failureCallbackQueue); _failureCallbackQueue = NULL; } - } - (NSError *)error { diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 936a2d2..8ff123a 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -186,10 +186,6 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat } - (void)dealloc { - - - - if (_outputStream) { [_outputStream close]; _outputStream = nil; @@ -201,9 +197,6 @@ static inline BOOL AFStateTransitionIsValid(AFOperationState fromState, AFOperat _backgroundTaskIdentifier = UIBackgroundTaskInvalid; } #endif - - - } - (NSString *)description { From fefd1a77ff1ba1873ae5772fbae0681a42ef3382 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 16 Jul 2012 19:21:30 +0200 Subject: [PATCH 17/24] don't use __weak for completionBlocks. (Issue #414) We nil out the completionBlock manually in AFURLConnectionOperation. Using __weak here potentially doesn't call the set completion blocks. Restores iOS4 compatibility. Also shortens inline ifs with a ternary conditional(?:). --- AFNetworking/AFHTTPClient.m | 2 +- AFNetworking/AFHTTPRequestOperation.m | 17 +++++++----- AFNetworking/AFImageRequestOperation.m | 24 +++++++++-------- AFNetworking/AFJSONRequestOperation.m | 26 ++++++++++--------- AFNetworking/AFPropertyListRequestOperation.m | 24 +++++++++-------- AFNetworking/AFXMLRequestOperation.m | 18 +++++++------ 6 files changed, 61 insertions(+), 50 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 3bf0c11..cc7bfae 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -570,7 +570,7 @@ static void AFNetworkReachabilityReleaseCallback(const void *info) { for (AFHTTPRequestOperation *operation in operations) { AFCompletionBlock originalCompletionBlock = [operation.completionBlock copy]; operation.completionBlock = ^{ - dispatch_queue_t queue = operation.successCallbackQueue ? operation.successCallbackQueue : dispatch_get_main_queue(); + dispatch_queue_t queue = operation.successCallbackQueue ?: dispatch_get_main_queue(); dispatch_group_async(dispatchGroup, queue, ^{ if (originalCompletionBlock) { originalCompletionBlock(); diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 267d04d..35113fe 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -222,26 +222,29 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { - __weak AFHTTPRequestOperation *weakSelf = self; + // completion block is manually nilled out in AFURLConnectionOperation to break the retain cycle. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-retain-cycles" self.completionBlock = ^ { - if ([weakSelf isCancelled]) { + if ([self isCancelled]) { return; } - if (weakSelf.error) { + if (self.error) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { if (success) { - dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(weakSelf, weakSelf.responseData); + dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ + success(self, self.responseData); }); } } }; +#pragma clang diagnostic pop } - (void)setResponseFilePath:(NSString *)responseFilePath { diff --git a/AFNetworking/AFImageRequestOperation.m b/AFNetworking/AFImageRequestOperation.m index 3b13463..e19237e 100644 --- a/AFNetworking/AFImageRequestOperation.m +++ b/AFNetworking/AFImageRequestOperation.m @@ -82,7 +82,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { dispatch_async(image_request_operation_processing_queue(), ^(void) { UIImage *processedImage = imageProcessingBlock(image); - dispatch_async(requestOperation.successCallbackQueue ? requestOperation.successCallbackQueue : dispatch_get_main_queue(), ^(void) { + dispatch_async(requestOperation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) { success(operation.request, operation.response, processedImage); }); }); @@ -113,7 +113,7 @@ static dispatch_queue_t image_request_operation_processing_queue() { dispatch_async(image_request_operation_processing_queue(), ^(void) { NSImage *processedImage = imageProcessingBlock(image); - dispatch_async(requestOperation.successCallbackQueue ? requestOperation.successCallbackQueue : dispatch_get_main_queue(), ^(void) { + dispatch_async(requestOperation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) { success(operation.request, operation.response, processedImage); }); }); @@ -197,17 +197,18 @@ static dispatch_queue_t image_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { - __weak AFImageRequestOperation *weakSelf = self; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-retain-cycles" self.completionBlock = ^ { - if ([weakSelf isCancelled]) { + if ([self isCancelled]) { return; } dispatch_async(image_request_operation_processing_queue(), ^(void) { - if (weakSelf.error) { + if (self.error) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { @@ -218,15 +219,16 @@ static dispatch_queue_t image_request_operation_processing_queue() { NSImage *image = nil; #endif - image = weakSelf.responseImage; + image = self.responseImage; - dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(weakSelf, image); + dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ + success(self, image); }); } } }); - }; + }; +#pragma clang diagnostic pop } @end diff --git a/AFNetworking/AFJSONRequestOperation.m b/AFNetworking/AFJSONRequestOperation.m index e6968d9..f5c438e 100644 --- a/AFNetworking/AFJSONRequestOperation.m +++ b/AFNetworking/AFJSONRequestOperation.m @@ -96,38 +96,40 @@ static dispatch_queue_t json_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { - __weak AFJSONRequestOperation *weakSelf = self; - self.completionBlock = ^ { - if ([weakSelf isCancelled]) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-retain-cycles" + self.completionBlock = ^ { + if ([self isCancelled]) { return; } - if (weakSelf.error) { + if (self.error) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { dispatch_async(json_request_operation_processing_queue(), ^{ - id JSON = weakSelf.responseJSON; + id JSON = self.responseJSON; if (self.JSONError) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { if (success) { - dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(weakSelf, JSON); + dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ + success(self, JSON); }); } } }); } - }; + }; +#pragma clang diagnostic pop } @end diff --git a/AFNetworking/AFPropertyListRequestOperation.m b/AFNetworking/AFPropertyListRequestOperation.m index 2cf0d9d..21961d0 100644 --- a/AFNetworking/AFPropertyListRequestOperation.m +++ b/AFNetworking/AFPropertyListRequestOperation.m @@ -106,38 +106,40 @@ static dispatch_queue_t property_list_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { - __weak AFPropertyListRequestOperation *weakSelf = self; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-retain-cycles" self.completionBlock = ^ { - if ([weakSelf isCancelled]) { + if ([self isCancelled]) { return; } - if (weakSelf.error) { + if (self.error) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { dispatch_async(property_list_request_operation_processing_queue(), ^(void) { - id propertyList = weakSelf.responsePropertyList; + id propertyList = self.responsePropertyList; if (self.propertyListError) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { if (success) { - dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(weakSelf, propertyList); + dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ + success(self, propertyList); }); } } }); } - }; + }; +#pragma clang diagnostic pop } @end diff --git a/AFNetworking/AFXMLRequestOperation.m b/AFNetworking/AFXMLRequestOperation.m index dbc62a1..bdc935c 100644 --- a/AFNetworking/AFXMLRequestOperation.m +++ b/AFNetworking/AFXMLRequestOperation.m @@ -138,30 +138,32 @@ static dispatch_queue_t xml_request_operation_processing_queue() { - (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure { - __weak AFXMLRequestOperation *weakSelf = self; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-retain-cycles" self.completionBlock = ^ { - if ([weakSelf isCancelled]) { + if ([self isCancelled]) { return; } dispatch_async(xml_request_operation_processing_queue(), ^(void) { - NSXMLParser *XMLParser = weakSelf.responseXMLParser; + NSXMLParser *XMLParser = self.responseXMLParser; if (self.error) { if (failure) { - dispatch_async(weakSelf.failureCallbackQueue ? weakSelf.failureCallbackQueue : dispatch_get_main_queue(), ^{ - failure(weakSelf, weakSelf.error); + dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); }); } } else { if (success) { - dispatch_async(weakSelf.successCallbackQueue ? weakSelf.successCallbackQueue : dispatch_get_main_queue(), ^{ - success(weakSelf, XMLParser); + dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ + success(self, XMLParser); }); } } }); - }; + }; +#pragma clang diagnostic pop } @end From 109037831a7cb5461d0c383bc3c348003b1a7d29 Mon Sep 17 00:00:00 2001 From: George Cox Date: Thu, 26 Jul 2012 08:05:20 -0400 Subject: [PATCH 18/24] Fixed compiler error in AFHTTPRequestOperation; #417 Casting (void *) block to (__bridge id). Required as of Xcode 4.4 --- AFNetworking/AFHTTPRequestOperation.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 267d04d..c78e8ef 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -56,7 +56,7 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) { static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, void *block) { Method originalMethod = class_getClassMethod(klass, selector); - IMP implementation = imp_implementationWithBlock(block); + IMP implementation = imp_implementationWithBlock((__bridge id)(block)); class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod)); } From 2834ecc97d0c9bd44165586cf7e804c3aa6939f5 Mon Sep 17 00:00:00 2001 From: George Cox Date: Thu, 26 Jul 2012 08:17:01 -0400 Subject: [PATCH 19/24] Changed string format specifiers for NSUInteger values from %u to %lu Resolves two compiler warnings in AFHTTPRequestOperation.m and one in AFHTTPClient.m --- AFNetworking/AFHTTPClient.m | 2 +- AFNetworking/AFHTTPRequestOperation.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 3bf0c11..71a53a3 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -705,7 +705,7 @@ static inline NSString * AFMultipartFormFinalBoundary() { self.request = request; self.stringEncoding = encoding; - self.temporaryFilePath = [AFMultipartTemporaryFileDirectoryPath() stringByAppendingPathComponent:[NSString stringWithFormat:@"%u", [[self.request URL] hash]]]; + self.temporaryFilePath = [AFMultipartTemporaryFileDirectoryPath() stringByAppendingPathComponent:[NSString stringWithFormat:@"%lu", [[self.request URL] hash]]]; self.outputStream = [NSOutputStream outputStreamToFileAtPath:self.temporaryFilePath append:NO]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 267d04d..67f516f 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -76,11 +76,11 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) { } if (range.length == 1) { - [string appendFormat:@"%u", range.location]; + [string appendFormat:@"%lu", range.location]; } else { NSUInteger firstIndex = range.location; NSUInteger lastIndex = firstIndex + range.length - 1; - [string appendFormat:@"%u-%u", firstIndex, lastIndex]; + [string appendFormat:@"%lu-%lu", firstIndex, lastIndex]; } range.location = nextIndex; From 4809c774278f4b52d537e0fe6b92d73813ffe15d Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Sat, 4 Aug 2012 15:28:32 -0400 Subject: [PATCH 20/24] Updating project settings for Xcode 4.4 --- Example/AFNetworking iOS Example.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj index 987dfbf..b97693c 100644 --- a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj @@ -277,7 +277,7 @@ F8E469571395739C00DB05C8 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0430; + LastUpgradeCheck = 0440; ORGANIZATIONNAME = Gowalla; }; buildConfigurationList = F8E4695A1395739C00DB05C8 /* Build configuration list for PBXProject "AFNetworking iOS Example" */; From d02d9612dd1af84a8d9646d7b497fb83a3e2bc23 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Sat, 4 Aug 2012 15:29:00 -0400 Subject: [PATCH 21/24] Changing string format replacement tokens to suppress compiler warnings --- AFNetworking/AFHTTPClient.m | 2 +- AFNetworking/AFHTTPRequestOperation.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 619e7c9..1dd08ad 100644 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -703,7 +703,7 @@ static inline NSString * AFMultipartFormFinalBoundary() { self.request = request; self.stringEncoding = encoding; - self.temporaryFilePath = [AFMultipartTemporaryFileDirectoryPath() stringByAppendingPathComponent:[NSString stringWithFormat:@"%lu", [[self.request URL] hash]]]; + self.temporaryFilePath = [AFMultipartTemporaryFileDirectoryPath() stringByAppendingPathComponent:[NSString stringWithFormat:@"%u", [[self.request URL] hash]]]; self.outputStream = [NSOutputStream outputStreamToFileAtPath:self.temporaryFilePath append:NO]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 67825ab..2927da7 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -76,11 +76,11 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) { } if (range.length == 1) { - [string appendFormat:@"%lu", range.location]; + [string appendFormat:@"%u", range.location]; } else { NSUInteger firstIndex = range.location; NSUInteger lastIndex = firstIndex + range.length - 1; - [string appendFormat:@"%lu-%lu", firstIndex, lastIndex]; + [string appendFormat:@"%u-%u", firstIndex, lastIndex]; } range.location = nextIndex; From 95f2f5360427dba1b1ee3007df34ca3501ea922f Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Fri, 14 Sep 2012 09:01:54 -0700 Subject: [PATCH 22/24] Updating project settings --- Example/AFNetworking iOS Example.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj index b97693c..7cb72b6 100644 --- a/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj +++ b/Example/AFNetworking iOS Example.xcodeproj/project.pbxproj @@ -277,7 +277,7 @@ F8E469571395739C00DB05C8 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0440; + LastUpgradeCheck = 0450; ORGANIZATIONNAME = Gowalla; }; buildConfigurationList = F8E4695A1395739C00DB05C8 /* Build configuration list for PBXProject "AFNetworking iOS Example" */; From c8d9f79ef9f924a04a75121dc8c66340eb8670d6 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Fri, 14 Sep 2012 09:02:32 -0700 Subject: [PATCH 23/24] [#417] Fixing compilation error in Xcode 4.5 --- AFNetworking/AFHTTPRequestOperation.m | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m index 743f159..dd3fa40 100644 --- a/AFNetworking/AFHTTPRequestOperation.m +++ b/AFNetworking/AFHTTPRequestOperation.m @@ -23,6 +23,13 @@ #import "AFHTTPRequestOperation.h" #import +// Workaround for change in imp_implementationWithBlock() +#ifdef __IPHONE_6_0 + #define AF_CAST_TO_BLOCK id +#else + #define AF_CAST_TO_BLOCK __bridge void * +#endif + NSString * const kAFNetworkingIncompleteDownloadDirectoryName = @"Incomplete"; NSSet * AFContentTypesFromHTTPHeader(NSString *string) { @@ -54,9 +61,9 @@ NSSet * AFContentTypesFromHTTPHeader(NSString *string) { return [NSSet setWithSet:mutableContentTypes]; } -static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, void *block) { +static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, id block) { Method originalMethod = class_getClassMethod(klass, selector); - IMP implementation = imp_implementationWithBlock((__bridge id)(block)); + IMP implementation = imp_implementationWithBlock((AF_CAST_TO_BLOCK)block); class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod)); } @@ -266,7 +273,7 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { + (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes { NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]]; [mutableStatusCodes addIndexes:statusCodes]; - AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), (__bridge void *)^(id _self) { + AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), ^(id _self) { return mutableStatusCodes; }); } @@ -278,7 +285,7 @@ NSString * AFCreateIncompleteDownloadDirectoryPath(void) { + (void)addAcceptableContentTypes:(NSSet *)contentTypes { NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES]; [mutableContentTypes unionSet:contentTypes]; - AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), (__bridge void *)^(id _self) { + AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), ^(id _self) { return mutableContentTypes; }); } From c1d3d840939af649df01283323871980b68c3a02 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Fri, 14 Sep 2012 10:34:10 -0700 Subject: [PATCH 24/24] Updating podspec to 1.0RC2 --- AFNetworking.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AFNetworking.podspec b/AFNetworking.podspec index f8ffa44..b1055c3 100644 --- a/AFNetworking.podspec +++ b/AFNetworking.podspec @@ -1,11 +1,11 @@ Pod::Spec.new do |s| s.name = 'AFNetworking' - s.version = '0.10.1' + s.version = '1.0RC2' s.license = 'MIT' s.summary = 'A delightful iOS and OS X networking framework.' s.homepage = 'https://github.com/AFNetworking/AFNetworking' s.authors = {'Mattt Thompson' => 'm@mattt.me', 'Scott Raymond' => 'sco@scottraymond.net'} - s.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => '0.10.1' } + s.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => '1.0RC2' } s.source_files = 'AFNetworking' s.framework = 'SystemConfiguration' s.prefix_header_contents = "#import "