title: Converting NSNumbers saved in a plist to integers
body: <p>Saving data:</p>
  
  <pre><code>- (NSString *)dataFilePath
  {
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectory = [paths objectAtIndex:0];
  return [documentsDirectory stringByAppendingPathComponent:kFilename];
  }
  - (void)applicationWillTerminate:(NSNotification *)notification
  {
  NSMutableArray *array = [[NSMutableArray alloc] init];
  
  NSNumber *number = [NSNumber numberWithInt:points];
    [array addObject:number];
  
    [array writeToFile:[self dataFilePath] atomically:YES];
    [array release];
  }
  </code></pre>
  
  <p>Reading data:
  BestLabel.text will display the high score. I get a warning: "assignment makes integer from pointer without a cast"</p>
  
  <pre><code>-(void)LoadData{
  BestLabel.center = CGPointMake(150,300);
  
  NSString *filePath = [self dataFilePath];
  if ([[NSFileManager defaultManager] fileExistsAtPath:filePath])
  {
      NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
      loadint = [array objectAtIndex:0];
      NSString *myString35 = [NSString stringWithFormat:@"%d", loadint]; 
      BestLabel.text = myString35;
      [array release];
  }
  }
  </code></pre>
  
  <p>The sample code I got this from was saving and loading text fields with no problem.. I suppose I could do a string to int conversion, but that seems unnecessary. Thanks for your help! </p>
  
  <p>EDIT:</p>
  
  <pre><code>- (void)applicationWillTerminate:(NSNotification *)notification
  </code></pre>
  
  <p>{
      NSMutableArray *array = [[NSMutableArray alloc] init];</p>
  
  <pre><code>if (points &gt; highscore){
  
      NSString *myString35 = [NSString stringWithFormat:@"%d", points];
      [array addObject:myString35];
  }else {
      NSString *myString35 = [NSString stringWithFormat:@"%d", highscore];
      [array addObject:myString35];
  }
  
  
  NSNumber *number = [NSNumber numberWithInt:GreenBlot.center.x];
  [array addObject:number];
  NSNumber *number2 = [NSNumber numberWithInt:GreenBlot.center.y];
  [array addObject:number2];
  </code></pre>
  
  <p>And now loading with:</p>
  
  <pre><code>NSString *filePath = [self dataFilePath];
  if ([[NSFileManager defaultManager] fileExistsAtPath:filePath])
  {
      NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:filePath];
      BestLabel.text = [array objectAtIndex:0];
      highscore = [[array objectAtIndex:0] intValue];
  
  
      lx = [[array objectAtIndex:1] intValue];
      ly = [[array objectAtIndex:2] intValue];
      GreenBlot.center = CGPointMake( lx,ly);
  
  
      [array release];
  }
  </code></pre>
  
  <p>lx and ly are integers. I tried CGPointMake( [[array objectAtIndex:1] intValue], [[array objectAtIndex:2] intValue] ) first. Same results, GreenBlot is getting centered at 0,0. Any idea why?</p>