In Objective-c, I have variables set in the interface file:
#import <Cocoa/Cocoa.h>
@interface TestApp_BotAppDelegate : NSObject <NSApplicationDelegate>
{
NSString * someString;
}
- (IBAction) doSomething:(id)sender;
@end
And have this
#import "TestApp_BotAppDelegate.h"
@implementation TestApp_BotAppDelegate
@synthesize window;
@synthesize Buildings;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
someString=@"HELLO";
}
- (IBAction) doSomething:(id) sender
{
NSLog(@"%@", someString);
}
@end
When i call doSomething from a button in the UI, I get a bad access error.
I know you that this is supposed to happen, but I don't know why or a workaround.
Thanks, Will