title: -[Person componentsSeparatedByString:]: unrecognized selector sent to instance
body: <p>I'm new to programming, and I feel a little intimidated posting, and I'm stuck. I don't want a quick fix! Please help me understand this.</p>
  
  <p>I've created a custom method with a name, age, height and gender. It gets called when the <code>NSMutableArray</code> adds custom objects to the array. For some reason I cannot pull said items out of the <code>NSMutableArray</code>. Let's say the age needs to be printed out. I get a error saying...</p>
  
  <p><code>-[Person componentsSeparatedByString:]:</code> unrecognized selector sent to instance</p>
  
  <p><strong>Person.m</strong></p>
  
  <pre><code>- (id)initWithName:(NSString *)n
              age:(int)a
           height:(float)h
           gender:(char)g
  {
  self = [super init];
  if (self) {
      self.name = n;
      self.age = a;
      self.height = h;
      self.gender = g;
  }
  
      return self;
  }
  
  - (NSString *)description
  {
  NSString *descriptionString = [[NSString alloc] initWithFormat:@"%@, %d, %.1f, %c",
                                 self.name,
                                 self.age,
                                 self.height,
                                 self.gender];
  NSLog(@"Description String: %@", descriptionString);
      return descriptionString;
  }
  </code></pre>
  
  <p>When adding objects to the NSMutableArray they get converted to a NSString? How do I get the peoples age without the whole strings name and height in the NSLog?</p>
  
  <p><strong>ViewController.m</strong></p>
  
  <pre><code>[self.people addObject:[[Person alloc] initWithName:@"Jake" age:29 height:73.5 gender:'f']];
  [self.people addObject:[[Person alloc] initWithName:@"Jerry" age:24 height:82.3 gender:'m']];
  [self.people addObject:[[Person alloc] initWithName:@"Jessica" age:29 height:67.2 gender:'f']];
  
  NSString *mystring1 = [self.people objectAtIndex:0];
  NSLog(@"%@", mystring1);
  
  // Works
  //NSString *list = @"Norm, 42, 73.2, m";
  
  NSArray *listItems = [self.people[0] componentsSeparatedByString:@", "];
  NSLog(@"List Items: %@", listItems[1]);// age
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>Description String: Jake, 29, 73.5, f
  Jake, 29, 73.5, f
  -[Person componentsSeparatedByString:]: unrecognized selector sent to instance
  </code></pre>
  
  <p><strong>Solved:</strong></p>
  
  <p>Notice the extra [ age];</p>
  
  <pre><code>int age = [[self.people objectAtIndex:0]age];
  NSLog(@"%d", age);
  </code></pre>