title: Calling a class method from a View gives: "Unrecognized selector sent to class"
body: <p>I'm trying to call a class method that is defined in an imported header file.</p>
  
  <p>When I run the code below, I get this error in the View on the "double *result = ..." line:</p>
  
  <pre><code>+[CalculatorBrain runProgram:usingVariableValues:]: unrecognized selector sent to class 0x6908
  </code></pre>
  
  <h2>** CalculatorViewController.m **</h2>
  
  <pre><code>#import "CalculatorViewController.h"
  #import "CalculatorBrain.h"
  
  @interface CalculatorViewController()
  
  @property (nonatomic, strong) CalculatorBrain *brain;
  @property (nonatomic, strong) NSMutableDictionary *variableValues;
  
  @end
  
  @implementation CalculatorViewController
  
  @synthesize brain = _brain;
  @synthesize variableValues = _variableValues;
  
  - (CalculatorBrain *)brain {
      if (!_brain) _brain = [[CalculatorBrain alloc] init];
      return _brain;
  }
  
  - (NSMutableDictionary *)variableValues {
      if (!_variableValues) {
          _variableValues = [[NSMutableDictionary alloc] init];
      }
      return _variableValues;
  }
  
  - (IBAction)enterPressed {
  
      double *result = [CalculatorBrain runProgram:[self.brain program] usingVariableValues:[self variableValues]];
  
  }
  </code></pre>
  
  <h2>** CalculatorBrain.h **</h2>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface CalculatorBrain : NSObject
  
  + (double *)runProgram:(id)program usingVariableValues:(NSDictionary *)variableValues;
  
  @property (readonly) id program;
  
  
  @end
  </code></pre>
  
  <h2>** CalculatorBrain.m **</h2>
  
  <pre><code>#import "CalculatorBrain.h"
  
  @interface CalculatorBrain()
      @property (nonatomic, strong) NSMutableArray *programStack;
  @end
  
  @implementation CalculatorBrain
  
  @synthesize programStack = _programStack;
  
  
  ... other code ...
  
  + (double)runProgram:(id)program :(NSDictionary *) usingVariableValues 
  {
  
      NSLog(@"variableValues is %@", usingVariableValues);
  
      NSMutableArray *stack;
  
      if ([program isKindOfClass:[NSArray class]]) {
  
          stack = [program mutableCopy];
  
          NSLog(@"runProgram");
  
          // if vars are passed in
          if ([usingVariableValues isKindOfClass:[NSDictionary class]]) {
  
              NSLog(@"vars are passed in: %@", usingVariableValues);
  
              id obj;
              int index = 0;
  
              NSEnumerator *enumerator = [program objectEnumerator];
  
              // for every obj in programStack
              while ((obj = [enumerator nextObject])) {
  
                  id varVal = [usingVariableValues objectForKey:(obj)];
  
                  // test
                  NSLog(@"usingVariableValues objectForKey:(obj) is %@", varVal);
  
                  // if the obj is a variable key
                  if (!varVal) {
                      varVal = 0;
  
                      NSLog(@"varVal is false");
                  }
  
                  NSLog(@"Replacing object at index %@ of stack with var %@", index, varVal);
  
  
                  // replace the variable with value from usingVariableValues OR 0
                  [stack replaceObjectAtIndex:(index) withObject:varVal];
  
                  index += 1;
  
              }
          }
  
      }
  
      return [self popOperandOffStack:stack];
  }
  </code></pre>