Hello,
I recently bought the book MAC Programming for absolute beginners.
I've tried one of the example described in the book to connect some code to the User Interface, but the example doesn't work and I don't know what I am doing wrong. I have followed the instructions of the book. Can somebody help me?
".h file"
".m file"
The compiler always gives a "BUILD FAILED" for the 2 lines in BOLD
I recently bought the book MAC Programming for absolute beginners.
I've tried one of the example described in the book to connect some code to the User Interface, but the example doesn't work and I don't know what I am doing wrong. I have followed the instructions of the book. Can somebody help me?
".h file"
Code:
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
{
NSWindow *window;
NSTextField *message;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSTextField *message;
-(IBAction)goodBye:(id)sender;
@end
".m file"
Code:
#import "AppDelegate.h"
@implementation AppDelegate
[B]@synthesize window;
@synthesize message;[/B]
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSLog (@"Hello World!");// Insert code here to initialize your application
}
-(IBAction)goodBye:(id)sender
{
message.stringValue = @"Good-bye";
}
@end
The compiler always gives a "BUILD FAILED" for the 2 lines in BOLD
Last edited by a moderator: