title: Setting static variables in Objective C
body: <p>I can't seem to find a way to set the static int I have created to assign unique ids to every object I save to persistent memory. The following gives me a 'no setter method 'setIdGen' for assignment to property.</p>
  
  <pre><code>-(void)viewDidLoad
  {
      PlayerMenuController.idGen = [[NSUserDefaults standardUserDefaults] floatForKey:@"idGen"];
  }
  </code></pre>
  
  <p>As well as the above I've tried creating a static setIdGen method that would return bad access errors, and making NSIntegers with their own set methods. My static NSMutableArray gave the same errors when I tried to assign it using = but worked fine when using setArray.</p>
  
  <p>idGen method:</p>
  
  <pre><code>+ (int) idGen
  {
      /*static int idGen;
      if(!idGen)
      {
          idGen = 0;
          NSLog(@"idGen reset");
      }*/
      return self.idGen;
  }
  </code></pre>