title: iPhone sdk: I'm trying to increase an integer by 10 and failing
body: <p><strong>(Problem solved now, see answers below)</strong></p>
  
  <p>Hello, in my app I am trying to create a points counter. That increases a number by 10 every time a button is pressed. </p>
  
  <p>I successfully managed to get my app to increase a value (0) by 1 every time a button is pressed, and to remember the latest value and display it next time the app starts. But when you press the button that's suppose to increase the points value by 1 after the app restarts the number starts increasing from 0 not the remembered value.</p>
  
  <p>How would I get the points to increase by 10  and remember the latest value and display (and count from it) after the application is exited and started again ? </p>
  
  <p>Here is my current code:</p>
  
  <p>Code for the button to increase the value by 1:</p>
  
  <pre><code>   - (IBAction)startClick:(id)sender{
  NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
  [prefs setInteger:count forKey:@"greeting"];
  
  NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count++];
  counter.text = numValue;
  </code></pre>
  
  <p>viewDidLoad method:</p>
  
  <pre><code>   - (void)viewDidLoad {
  NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
  NSString *greetName = [prefs stringForKey:@"greeting"];
  NSInteger count = [prefs integerForKey:@"greeting"];
  counter.text = [[NSString alloc] initWithFormat:@"%@",greetName];
  
  if(count == 0) {
      counter.text = [[NSString alloc] initWithFormat:@"%@",greetName];
  } else {
      counter.text = [[NSString alloc] initWithFormat:@"%@",greetName];
  }
  </code></pre>