From 504146d6b5645efe078f8497174fce1cd60d6ef8 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Fri, 11 Nov 2011 11:50:32 -0600 Subject: [PATCH 1/6] Updating Podspec to new repository URL --- AFNetworking.podspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AFNetworking.podspec b/AFNetworking.podspec index a7bc6d4..5b70248 100644 --- a/AFNetworking.podspec +++ b/AFNetworking.podspec @@ -2,9 +2,9 @@ Pod::Spec.new do |s| s.name 'AFNetworking' s.version '0.8.0' s.summary 'A delightful iOS and OS X networking framework' - s.homepage 'https://github.com/gowalla/AFNetworking' + s.homepage 'https://github.com/AFNetworking/AFNetworking' s.authors {'Mattt Thompson' => 'm@mattt.me', 'Scott Raymond' => 'sco@gowalla.com'} - s.source :git => 'https://github.com/gowalla/AFNetworking.git', + s.source :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => '0.8.0' s.platforms 'iOS', 'OSX' From 3bc5351c6382e88823b66ca09bf1e2cd3fd910c8 Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Fri, 11 Nov 2011 13:09:38 -0600 Subject: [PATCH 2/6] =?UTF-8?q?Fixing=20Podspec=20(Thanks,=20Eloy=20Dur?= =?UTF-8?q?=C3=A1n)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AFNetworking.podspec | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/AFNetworking.podspec b/AFNetworking.podspec index 5b70248..c481d1a 100644 --- a/AFNetworking.podspec +++ b/AFNetworking.podspec @@ -1,14 +1,11 @@ Pod::Spec.new do |s| - s.name 'AFNetworking' - s.version '0.8.0' - 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@gowalla.com'} - s.source :git => 'https://github.com/AFNetworking/AFNetworking.git', - :tag => '0.8.0' + s.name = 'AFNetworking' + s.version = '0.8.0' + 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@gowalla.com'} + s.source = :git => 'https://github.com/AFNetworking/AFNetworking.git', + :tag => '0.8.0' - s.platforms 'iOS', 'OSX' - s.sdk '>= 4.0' - - s.source_files 'AFNetworking' -end \ No newline at end of file + s.source_files = 'AFNetworking' +end From 5a3a9b2f416c9e8dc7ea4c7994daa122be1444cc Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Fri, 11 Nov 2011 13:22:50 -0600 Subject: [PATCH 3/6] Updating README to document removal of JSONKit dependency and fixing AFHTTPClient example --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8626abe..13d7c91 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,9 @@ UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0 ``` objective-c // AFGowallaAPIClient is a subclass of AFHTTPClient, which defines the base URL and default HTTP headers for NSURLRequests it creates -[[AFGowallaAPIClient sharedClient] getPath:@"/spots/9223" parameters:nil success:^(id response) { - NSLog(@"Name: %@", [response valueForKeyPath:@"name"]); - NSLog(@"Address: %@", [response valueForKeyPath:@"address.street_address"]); +[[AFGowallaAPIClient sharedClient] getPath:@"/spots/9223" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSLog(@"Name: %@", [responseObject valueForKeyPath:@"name"]); + NSLog(@"Address: %@", [responseObject valueForKeyPath:@"address.street_address"]); } failure:nil]; ``` @@ -118,10 +118,6 @@ If you are including AFNetworking in a project that uses [Automatic Reference Co Although this is suboptimal, forking the project into an ARC and non-ARC branch would be extremely difficult to maintain. On the bright side, we're very excited about [CocoaPods](https://github.com/alloy/cocoapods) as a potential solution. -## Dependencies - -* [JSONKit](https://github.com/johnezang/JSONKit) - ## Credits AFNetworking was created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://itunes.apple.com/us/app/gowalla/id304510106?mt=8). From d159be3757b13ae1ec5c7b661d8a96914208794d Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Sat, 12 Nov 2011 18:19:00 -0600 Subject: [PATCH 4/6] Adding missing authorization header in example --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 13d7c91..6dbd910 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ NSOperationQueue *queue = [[[NSOperationQueue alloc] init] autorelease]; ``` objective-c NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://gowalla.com/friendships/request?user_id=1699"]]; [request setHTTPMethod:@"POST"]; +[request setValue:@"#{Base64-Encoded Credentials}" forHTTPHeaderField:@"Authorization"]; AFHTTPRequestOperation *operation = [[[AFHTTPRequestOperation alloc] initWithRequest:request] autorelease]; operation.completionBlock = ^ { From 10165ccc6f9762c7b98acfc625988b1246a68090 Mon Sep 17 00:00:00 2001 From: chaiwats Date: Mon, 14 Nov 2011 18:18:01 +0700 Subject: [PATCH 5/6] fix AFJSONEncode to work properly --- AFNetworking/AFJSONUtilities.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/AFNetworking/AFJSONUtilities.h b/AFNetworking/AFJSONUtilities.h index 9c1e5ca..edfa4fe 100644 --- a/AFNetworking/AFJSONUtilities.h +++ b/AFNetworking/AFJSONUtilities.h @@ -32,9 +32,9 @@ static NSData * AFJSONEncode(id object, NSError **error) { id _NSJSONSerializationClass = NSClassFromString(@"NSJSONSerialization"); SEL _NSJSONSerializationSelector = NSSelectorFromString(@"dataWithJSONObject:options:error:"); - if (_JSONKitSelector && [data respondsToSelector:_JSONKitSelector]) { - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[data methodSignatureForSelector:_JSONKitSelector]]; - invocation.target = data; + if (_JSONKitSelector && [object respondsToSelector:_JSONKitSelector]) { + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:_JSONKitSelector]]; + invocation.target = object; invocation.selector = _JSONKitSelector; NSUInteger serializeOptionFlags = 0; @@ -43,21 +43,21 @@ static NSData * AFJSONEncode(id object, NSError **error) { [invocation invoke]; [invocation getReturnValue:&data]; - } else if (_SBJSONSelector && [data respondsToSelector:_SBJSONSelector]) { + } else if (_SBJSONSelector && [object respondsToSelector:_SBJSONSelector]) { NSString *JSONString = nil; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[data methodSignatureForSelector:_SBJSONSelector]]; - invocation.target = data; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:_SBJSONSelector]]; + invocation.target = object; invocation.selector = _SBJSONSelector; [invocation invoke]; [invocation getReturnValue:&data]; data = [JSONString dataUsingEncoding:NSUTF8StringEncoding]; - } else if (_YAJLSelector && [data respondsToSelector:_YAJLSelector]) { + } else if (_YAJLSelector && [object respondsToSelector:_YAJLSelector]) { @try { NSString *JSONString = nil; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[data methodSignatureForSelector:_YAJLSelector]]; - invocation.target = data; + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:_YAJLSelector]]; + invocation.target = object; invocation.selector = _YAJLSelector; [invocation invoke]; From ba29765ca9401689c558a4d20c7e3093fc60daae Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Mon, 14 Nov 2011 14:24:21 -0600 Subject: [PATCH 6/6] Fixing formatting for URL construction example code in AFHTTPClient --- AFNetworking/AFHTTPClient.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/AFNetworking/AFHTTPClient.h b/AFNetworking/AFHTTPClient.h index 3a61d89..0c02b60 100644 --- a/AFNetworking/AFHTTPClient.h +++ b/AFNetworking/AFHTTPClient.h @@ -90,15 +90,14 @@ extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *paramete Both `requestWithMethod:path:parameters` and `multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interract: - ``` - NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; - [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo - [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz - [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo - [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo - [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ - [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ - ``` + NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; + [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz + [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo + [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ + [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ + */ @interface AFHTTPClient : NSObject { @private