title: How to Modify an Instance in Another Class with AFNetworking - Creating API Client
body: <p>Having this issue, because I'm trying to develop my code. Before, I was using AFNetworking methods in the classes, but I got 4 of them. Instead of that repeatin sequence, I wanted to have APIClient, which has the methods. I implemented some methods but my issue is about just two of them.</p>
  
  <p>So, in APIClient.m I have the followings:</p>
  
  <pre><code>+(void)GetCurrencyInformationFrom:(NSString *)URLString to:(NSArray *) array inThe:(UITableView *) tableView{
      NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; // User informations.
      NSString *accessToken = [defaults objectForKey:@"accessToken"];
  
      AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
      manager.responseSerializer = [AFJSONResponseSerializer serializer];
      [manager.requestSerializer setValue:accessToken forHTTPHeaderField:@"Token"];
  
      NSLog(@"access token: %@", accessToken);
      NSLog(@"id: %@", [defaults objectForKey:@"ID"]);
  
      [manager GET:URLString parameters:nil  success:^(AFHTTPRequestOperation *operation, id responseObject) {
          [self update:array withDictionary:responseObject inThe:tableView];
      } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
          NSLog(@"Error 2: %@", error);
      }];
  }
  
  +(void)update:(NSArray *)array withDictionary:(NSDictionary *)dictionary inThe:(UITableView *) tableView{
      NSLog(@"Data Count: %lu", [dictionary[@"Data"] count]);
      array = [[NSMutableArray alloc] initWithArray:dictionary[@"Data"]];
      NSLog(@"Array Count: %lu", [array count]);
      [tableView reloadData];
  }
  </code></pre>
  
  <p>Those methods are called in Table View classes. For example, one of my classes I called within the <code>viewload</code> those:</p>
  
  <pre><code>NSString *URL = @"http://api-dvzalt.azurewebsites.net/api/Currency/Doviz";
  
  [APIClient GetCurrencyInformationFrom:URL to:currencyArray inThe: tableView];
  </code></pre>
  
  <p>For debugging, I am printing the Data count and Array count (Both you can find in update:withDictionary:inThe: method) and number of rows (in the table class). It's normal to number of rows to be zero at the beginning since it is asychronous, however, after I reload my tableView, i.e. after everything is done (see [tableView reloatData] in update:withDictionary:inThe method) number of rows remains zero, where Data and Array's count are 20. And of course, with zero rows, nothing showed up on the table. So, basically my problem is the currencyArray I'm giving to method doesn't change after it comes back to the tableView again even it is changing in the APIClient class.</p>
  
  <p>I feel like it is a simple mistake, but I can't see where it is. Glad if you can help me to find it. </p>
  
  <p>Thanks!</p>