Я добавил объект класса в файл пера.Все подключения выполнены.
Но по какой-то причине объект освобождается сразу после его создания.
Вот код:
control.h:
#import <Foundation/Foundation.h>
@interface control : NSObject
{
IBOutlet UILabel *PlayerScore;
}
-(IBAction) addPoint: sender;
-(void) dealloc;
@end
control.m:
#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
Вот журнал консоли:
[Сессия началась в 2010-06-09 19:47:57 +1000.]
2010-06-09 19: 47: 58.771 Приложение [91100: 207] ZOMGWTF?
И после того, как я нажимаю кнопку, на которой сообщения addPoint, естественно, вылетает.
2010-06-09 19: 47: 59.703 Приложение [91100: 207]*** - [control] executeSelector: withObject: withObject:]: сообщение отправлено освобожденному экземпляру 0x3843d80
У кого-нибудь есть идеи?