title: Accessing objects and its properties inside an array of objects in Objective-C
body: <p>I am new coding in Objective-C and I am trying to figure out how to do the following:</p>
  
  <p>I have a class <code>Company</code>:</p>
  
  <pre><code>@interface Company : NSObject
  
  @property (strong, nonatomic)NSString *companyID;
  
  @property (strong, nonatomic)NSString *companyName;
  
  @end
  </code></pre>
  
  <p>I am getting a dictionary from a server and just parsing in objects.
  After that, I am adding these objects in an array (It´s working - no problem here - I got the JSON). </p>
  
  <pre><code>NSMutableDictionary *companyDictionary = [[NSMutableDictionary alloc]initWithDictionary:response];
  
  NSArray *companyArray = [companyDictionary valueForKey:@"data"];
  NSMutableArray *companyInformationArray = [NSMutableArray new];
  
  //Parser
  for (int i = 0; i &lt; [companyArray count]; i++) {
      Company *company = [Company new];
      company.companyID = [[companyArray objectAtIndex:i] valueForKey:@"company_id"];
      company.companyName = [[companyArray objectAtIndex:i] valueForKey:@"name"];
  
      [companyInformationArray addObject:company];
  }
  </code></pre>
  
  <p>THE PROBLEM IS: I need to access the objects and its fields inside</p>
  
  <pre><code>companyInformationArray
  </code></pre>
  
  <p>I am just trying to do something similar with (these two approaching will not work of course):</p>
  
  <pre><code>Company *company = [Company new];
  company = [[companyInformationArray objectAtIndex:0] valueForKey:@"name"];
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>Company *company = [Company new];
  company.companyName = [[companyInformationArray objectAtIndex:0] companyName];
  </code></pre>
  
  <p>Could you please help me?</p>
  
  <p>Thanks!</p>