Browse Source

Add image response serializer to UIButton+AFNetworking.
Without this fix, the responseObject is nil and the image does not get updated.

Sam Grossberg 12 years ago
parent
commit
4cf44857a3
1 changed files with 1 additions and 0 deletions
  1. 1 0
      UIKit+AFNetworking/UIButton+AFNetworking.m

+ 1 - 0
UIKit+AFNetworking/UIButton+AFNetworking.m

@@ -99,6 +99,7 @@ static char kAFBackgroundImageRequestOperationKey;
 
 
     __weak __typeof(self)weakSelf = self;
     __weak __typeof(self)weakSelf = self;
     self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
     self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest];
+    self.af_imageRequestOperation.responseSerializer = [AFImageResponseSerializer serializer];
     [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
     [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
         __strong __typeof(weakSelf)strongSelf = weakSelf;
         __strong __typeof(weakSelf)strongSelf = weakSelf;
         if ([[urlRequest URL] isEqual:[operation.request URL]]) {
         if ([[urlRequest URL] isEqual:[operation.request URL]]) {