title: Compiler error "setter method needed" to use dot syntax -- setter is defined
body: <p>I can't figure out why my getter and setter code is not working. In some example code I was going over:</p>
  
  <pre><code>- (NSArray *)sushiTypes {
    return _sushiRolls;
  }
  
  - (void)setSushiTypes:(NSArray *)sushiRolls {
    [sushiRolls retain];
    [_sushiRolls release];
    _sushiRolls = sushiRolls;
  }
  </code></pre>
  
  <p>Then in:</p>
  
  <pre><code>- (void)viewDidLoad {
    [super viewDidLoad];
    self.sushiTypes = [[NSArray alloc]initWithObjects:@"...]autorelease];
  }
  </code></pre>
  
  <p>The whole time, this worked, but a property for <code>sushiTypes</code> was never declared. I (sort of) get how this works, since it works the same as a setter/getter regardless of whether it was synthesized or not.</p>
  
  <p>But here's my code, and I get a compiler error asking for a property. Did I miss something?</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface Temp0 : NSObject {
      NSNumber *x1;
  }
  
  -(NSNumber *)x1;
  -(void)setx1:(NSNumber *)x;
  
  @end
  </code></pre>
  
  <hr>
  
  <pre><code>//
  #import "Temp0.h"
  
  @implementation Temp0
  
  -(NSNumber *)x1 {
      return x1;
  }
  
  -(void)setx1:(NSNumber *)x {
      [x retain];
      [x1 release];
      x1 = x;
  }
  
  -(id)init 
  {
      self.x1 = [[NSNumber alloc]initWithInt:1];    // Error on this line:
      // Setter method is needed to assign to object using property assignment syntax
      [super init];
  }
  
  @end
  </code></pre>
  
  <p><a href="http://i.stack.imgur.com/VttcZ.jpg" rel="nofollow">Screenshot of this code and the error in Xcode</a></p>