hello i am new in objective c and i have a question ¿why i get a (EXC_BAD_ACCESS) when i call the method "primera"?
the code is this:
#import <Cocoa/Cocoa.h>
@interface cont : NSObject {
IBOutlet id text;
}
- (IBAction)botonid)sender;
-(void)primera;
@end
and:
#import "cont.h"
@implementation cont
NSString *mensaje;
- (IBAction)botonid)sender {
mensaje = (@"hola");
cont *con;
[con primera];
}
-(void)primera{
[text setStringValuemensaje)];
}
@end
i know i can run the action from (- (IBAction)botonid)sender) but this is only one example. why is not possible to call another method from (-(IBAction)botonid)sender) also if the method "primera" is with (+) give me a warning (instance variable "text" accesed in class method ) ¿can somebody tell me how i can call the method "primera" from ((IBAction)botonid)sender)?
the code is this:
#import <Cocoa/Cocoa.h>
@interface cont : NSObject {
IBOutlet id text;
}
- (IBAction)botonid)sender;
-(void)primera;
@end
and:
#import "cont.h"
@implementation cont
NSString *mensaje;
- (IBAction)botonid)sender {
mensaje = (@"hola");
cont *con;
[con primera];
}
-(void)primera{
[text setStringValuemensaje)];
}
@end
i know i can run the action from (- (IBAction)botonid)sender) but this is only one example. why is not possible to call another method from (-(IBAction)botonid)sender) also if the method "primera" is with (+) give me a warning (instance variable "text" accesed in class method ) ¿can somebody tell me how i can call the method "primera" from ((IBAction)botonid)sender)?