title: correct way to send messages to (id *) variables or with (id *) arguments
body: <p>I have a Core Data validation method I wrote that will not compile.  I can modify the method so it compiles... but then I get runtime errors.  The two versions of the method are below (notice the missing '*' in the second version).  This version compiles but gives the runtime error "+[NSCFNumber doubleValue]: unrecognized selector sent to class 0x7fff70a448e8":</p>
  
  <pre><code>- (BOOL)validateInitialValue:(id *)value error:(NSError **)error {
      if ( *value == nil ) {
          return YES;
      }
      if ( [*value doubleValue] &lt; 0.0 ) {
          return NO;
      }
      return YES;
  }
  </code></pre>
  
  <p>This version gives compiler warnings and errors (see warnings and errors below):</p>
  
  <pre><code>- (BOOL)validateInitialValue:(id *)value error:(NSError **)error {
      if ( value == nil ) {
          return YES;
      }
      if ( [value doubleValue] &lt; 0.0 ) {
          return NO;
      }
      return YES;
  }
  </code></pre>
  
  <p>compiler errors and warnings:</p>
  
  <pre><code>warning: Semantic Issue: Receiver type 'id *' is not 'id' or interface pointer, consider casting it to 'id'
  warning: Semantic Issue: Method '-doubleValue' not found (return type defaults to 'id')
  error: Semantic Issue: Invalid operands to binary expression ('id' and 'double')
  </code></pre>
  
  <p>I finally figured that the problem may be in the calling code:</p>
  
  <pre><code>- (void)setInitialValue:(NSNumber *)initialValue {
      [self willChangeValueForKey:@"initialValue"];
      [self validateValue:initialValue forKey:@"initialValue" error:nil];
      [self setPrimitiveInitialValue:initialValue];
      [self didChangeValueForKey:@"initialValue"];
  }
  </code></pre>
  
  <p>I changed the caller to use an '&amp;' before initialValue and used the first version of the method, and everything worked.  So the new calling code has the one line changed to be this:</p>
  
  <pre><code>    [self validateValue:&amp;initialValue forKey:@"initialValue" error:nil];
  </code></pre>
  
  <p>But is it really necessary to have the '&amp;'??  setPrimitiveInitialValue doesn't use the '&amp;'.  I feel like my understanding of Objective-C is just not developed enough yet and all you gurus out there will find this a trivial question with a very straight forward answer.</p>