From 3a80dbc795e450a842a0ef04ef8febea5d25cd53 Mon Sep 17 00:00:00 2001 From: ijohn Date: Wed, 24 Oct 2012 13:09:54 +0700 Subject: [PATCH 1/2] Update Example/Classes/Models/Post.m Adapt to app.net global stream response change --- Example/Classes/Models/Post.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Example/Classes/Models/Post.m b/Example/Classes/Models/Post.m index c45c03d..2514a58 100644 --- a/Example/Classes/Models/Post.m +++ b/Example/Classes/Models/Post.m @@ -48,7 +48,8 @@ + (void)globalTimelinePostsWithBlock:(void (^)(NSArray *posts, NSError *error))block { [[AFAppDotNetAPIClient sharedClient] getPath:@"stream/0/posts/stream/global" parameters:nil success:^(AFHTTPRequestOperation *operation, id JSON) { - NSMutableArray *mutablePosts = [NSMutableArray arrayWithCapacity:[JSON count]]; + NSArray *postsFromResponse = [JSON valueForKeyPath:@"data"]; + NSMutableArray *mutablePosts = [NSMutableArray arrayWithCapacity:[postsFromResponse count]]; for (NSDictionary *attributes in JSON) { Post *post = [[Post alloc] initWithAttributes:attributes]; [mutablePosts addObject:post]; From 8f898addf2b489c0eb22c67abad7981fd7ef39ea Mon Sep 17 00:00:00 2001 From: ijohn Date: Wed, 24 Oct 2012 13:17:16 +0700 Subject: [PATCH 2/2] Update Example/Classes/Models/Post.m Sorry the previous commit left 1 crucial line :( --- Example/Classes/Models/Post.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Example/Classes/Models/Post.m b/Example/Classes/Models/Post.m index 2514a58..b76b1ef 100644 --- a/Example/Classes/Models/Post.m +++ b/Example/Classes/Models/Post.m @@ -50,7 +50,7 @@ [[AFAppDotNetAPIClient sharedClient] getPath:@"stream/0/posts/stream/global" parameters:nil success:^(AFHTTPRequestOperation *operation, id JSON) { NSArray *postsFromResponse = [JSON valueForKeyPath:@"data"]; NSMutableArray *mutablePosts = [NSMutableArray arrayWithCapacity:[postsFromResponse count]]; - for (NSDictionary *attributes in JSON) { + for (NSDictionary *attributes in postsFromResponse) { Post *post = [[Post alloc] initWithAttributes:attributes]; [mutablePosts addObject:post]; }