title: instance method not found (return type defaults to 'id'
body: <p>I wrote two programs during a training. But one exercise task drives me crazy. Not the task itself but the program and the behavior of it.</p>
  
  <p>The first program is to calculate the BMI of a person. Here it works all fine.</p>
  
  <p><strong>main.m</strong></p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import "Person.h"
  
  int main (int argc, const char * argv[])
  {
  
  @autoreleasepool {
  
      // Erstellt eine Instanz von Person
      Person *person = [[Person alloc]init];
  
      // Gibt den Instanzvariablen interessante Werte
      [person setWeightInKilos:93.2];
      [person setHeightInMeters:1.8];
  
      // Ruft die Methode bodyMassIndex auf
      float bmi = [person bodyMassIndex];
      NSLog(@"person (%dKg, %.2fm) has a BMI of %.2f", [person weightInKilos], 
  [person heightInMeters], bmi);
  
  
  }
  return 0;
  }
  </code></pre>
  
  <p><strong>Person.h</strong></p>
  
  <pre><code>@interface Person : NSObject
  {
  // Sie hat zwei Instanzvariablen
  float heightInMeters;
  int weightInKilos;
  }
  
  // Sie können diese Instanzvariablen anhand folgender Methoden setzen
  @property float heightInMeters;
  @property int weightInKilos;
  
  // Diese Methode berechnet den Body-Mass-Index
  - (float)bodyMassIndex;
  
  
  @end
  </code></pre>
  
  <p><strong>Person.m</strong></p>
  
  <pre><code>#import "Person.h"
  
  @implementation Person
  
  @synthesize heightInMeters, weightInKilos;
  
  - (float)bodyMassIndex
  {
  float h = [self heightInMeters];
  return [self weightInKilos] / (h * h);
  }
  @end
  </code></pre>
  
  <p>This program was written by the author of the training.</p>
  
  <p><strong>My task is to write a program what is equal.
  In my opinion it looks exactly the same:</strong></p>
  
  <p><strong>main.m</strong></p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import "StocksHolding.h"
  
  int main (int argc, const char * argv[])
  {
  
  @autoreleasepool {
  
      StocksHolding *stock1 = [[StocksHolding alloc]init];
  
      [stock1 purchaseSharePrice:1]; 
  /*Here I geht the error "Instance method '-purchaseSharePrice:' not found (return type
  defaults to 'id')*/
      NSLog(@"%i", [stock1 purchaseSharePrice]);
  
  }
  return 0;
  }
  </code></pre>
  
  <p><strong>StockHoldings.h</strong></p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface StocksHolding : NSObject
  {
  int purchaseSharePrice;
  float currentSharePrice;
  int numberOfShares;
  }
  @property int purchaseSharePrice;
  @property float currentSharePrice;
  @property int numberOfShares;
  
  - (float)costInDollars;
  - (float)valueInDollars;
  
  
  @end
  </code></pre>
  
  <p><strong>StockHoldings.m</strong></p>
  
  <pre><code>#import "StocksHolding.h"
  
  @implementation StocksHolding
  @synthesize purchaseSharePrice, currentSharePrice, numberOfShares;
  
  - (float)costInDollars
  {
  return purchaseSharePrice * numberOfShares;
  }
  - (float)valueInDollars
  {
  return currentSharePrice * numberOfShares;
  }
  
  
  @end
  </code></pre>
  
  <p>AS you can see... almost no differences except the names of the variables and methods.
  Where is the error?
  I was sitting for 3 hours at this question.</p>
  
  <p>Please give me a helping hand.</p>
  
  <p>Thanks
  Christian</p>