title: Why is an NSString 'forgetting' what it is?
body: <p>I was hoping for some help to understand why I need to re-cast my variable when it is a string from the start.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>+ (BOOL)hasOperandComponents:(NSString *)operandToTest
  {
      NSArray *componentsOfOperand = [[NSString stringWithFormat:@"%@",operandToTest] componentsSeparatedByString:@" "];
      if (componentsOfOperand.count&gt;1) return YES; return NO;
  }
  </code></pre>
  
  <p>If I don't use the embedded call to 'stringWithFormat' then I get the rather common error:</p>
  
  <pre><code>-[__NSCFNumber componentsSeparatedByString:]: unrecognized selector sent to instance
  </code></pre>
  
  <p>I have been able to find answers to what this error means and hence how to avoid it (see my code above) by searching other Q's and A's... but no good explanation as to why my operandToTest seems to 'forget' that it is a NSString and become an _NSCFNumber.</p>
  
  <p>I'm suspicious that it is because this is a Class method... but why would that matter when a specific instance of NSString *operandToTest is passed to the class method?</p>
  
  <p>Please help?</p>