From 4cf44857a365f2c738bbd3e97b54dda2f079f998 Mon Sep 17 00:00:00 2001 From: Sam Grossberg Date: Fri, 4 Oct 2013 16:24:41 -0700 Subject: [PATCH] Add image response serializer to UIButton+AFNetworking. Without this fix, the responseObject is nil and the image does not get updated. --- UIKit+AFNetworking/UIButton+AFNetworking.m | 1 + 1 file changed, 1 insertion(+) diff --git a/UIKit+AFNetworking/UIButton+AFNetworking.m b/UIKit+AFNetworking/UIButton+AFNetworking.m index 2e7585d..98648d8 100644 --- a/UIKit+AFNetworking/UIButton+AFNetworking.m +++ b/UIKit+AFNetworking/UIButton+AFNetworking.m @@ -99,6 +99,7 @@ static char kAFBackgroundImageRequestOperationKey; __weak __typeof(self)weakSelf = self; self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; + self.af_imageRequestOperation.responseSerializer = [AFImageResponseSerializer serializer]; [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { __strong __typeof(weakSelf)strongSelf = weakSelf; if ([[urlRequest URL] isEqual:[operation.request URL]]) {