• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Simple question about Objects and Delegates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: NSComboBox behaves differently under Jaguar and Panther
  • Next by Date: Printing webviews
  • Previous by thread: NSComboBox behaves differently under Jaguar and Panther
  • Next by thread: Printing webviews
  • Index(es):
    • Date
    • Thread