title: AFNetworking EXC_BAD_ACCESS in setCompletionBlock
body: <p>I'm working on an iOS app and am having some trouble with making a http request using AFNetworking. </p>
  
  <p>When I run the code I get the error: EXC_BAD_ACCESS(code=2 address=0x0).
  The error is occurring when I attempt to setCompletionBlock. </p>
  
  <p>I'm new to Objective-C and this has me stumped.</p>
  
  <p>Thank you in advance. Everyone's help is appreciated!</p>
  
  <pre><code>#import "AFNetworking.h"
  #import &lt;Cordova/CDV.h&gt;
  #import "UploadImg.h"
  
  @implementation UploadImg
  
  - (void) uploadImg:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options{
      NSURL *url = [NSURL URLWithString:@"http://test.com/mobile/"];
      AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
  
      NSData *imageData = [NSData dataFromBase64String:[arguments objectAtIndex:1]];
  
      NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
      [params setObject:@"TEST_STYLE" forKey:@"styleType"];
  
      NSMutableURLRequest *request = [httpClient multipartFormRequestWithMethod:@"POST" path:@"/upload.php" parameters:params constructingBodyWithBlock: ^(id &lt;AFMultipartFormData&gt;formData) {
          [formData appendPartWithFileData:imageData name:@"imageName" fileName:@"image.png" mimeType:@"image/png"];
      }];
  
      AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request];
  
      [operation  setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
          NSLog(@"success");
      } 
      failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          NSLog(@"error");
      }];
  
      [operation start];
  }
  
  @end
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ZCJ4G.png" alt="enter image description here"></p>
  
  <p>Thanks again!</p>