title: Custom class deallocated as soon as the app starts
body: <p>I've added a class object to the nib file. All connections are made.</p>
  
  <p>But for some reason, the object is deallocated as soon as it's created.</p>
  
  <p>Here's the code:</p>
  
  <p>control.h:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  @interface control : NSObject 
  {
      IBOutlet UILabel *PlayerScore;
  }
  -(IBAction) addPoint: sender;
  -(void) dealloc;
  @end
  </code></pre>
  
  <p>control.m:</p>
  
  <pre><code>#import "control.h"
  @implementation control
  -(IBAction)addPoint: sender {
      NSLog(@"Ohhai. Didn't crash."); //Doesn't even make it to this stage.
      int i = [PlayerScore.text intValue];
      PlayerScore.text=[NSString stringWithFormat: @"%d",++i];
  }
  -(void) dealloc {
      NSLog(@"ZOMGWTF?");
      [super dealloc];
  }
  @end
  </code></pre>
  
  <p>Here is the console log:</p>
  
  <blockquote>
    <p>[Session started at 2010-06-09 19:47:57 +1000.]<br>
    2010-06-09 19:47:58.771 App[91100:207] ZOMGWTF?  </p>
  </blockquote>
  
  <p>And after I click the button which messages addPoint, of course, it crashes.</p>
  
  <blockquote>
    <p>2010-06-09 19:47:59.703 App[91100:207] *** -[control] performSelector:withObject:withObject:]: message sent to deallocated instance 0x3843d80</p>
  </blockquote>
  
  <p>Does anyone have any ideas?</p>