Simple question about Objects and Delegates
Simple question about Objects and Delegates
- Subject: Simple question about Objects and Delegates
- From: "John Tsombakos" <email@hidden>
- Date: Tue, 11 Nov 2003 09:49:21 -0500
I thought I had a handle on the object / delegate, etc.
relationship of Cocoa, but I'm having a problem as I start
out. I want to try using the NSXMLParser class, so I set
up a simple project.
(I first found what might be a bug in Xcode - creating a
new subclass of NSObject, then trying to create the files
results in the sheet not finding the corresponding
project. I have to quit Xcode and Interface Builder and
restart both to get it to show.)
But that's not my problem. This is. I created a simple
subclass of NSObject in IB (and put a do nothing button in
the window, connected to the myAction method), and in the
.h file I have:
#import <Cocoa/Cocoa.h>
@interface MyObject : NSObject
{
NSXMLParser *parser;
}
- (IBAction)myAction:(id)sender;
@end
And the .m file is:
#import "MyObject.h"
@implementation MyObject
- (IBAction)myAction:(id)sender
{
}
-(void)awakeFromNib
{
parser = [[NSXMLParser alloc] init];
//[parser setDelegate:self];
NSLog(@"created parser");
}
-(void)dealloc
{
[parser release];
[super dealloc];
}
@end
Simple.
But, if I uncomment the setDelegate line, when I run the
app, it crashes with a signal 10.
Did I miss something? Is this a bad way to do this? Am I
on the right track?
Thanks.
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.