• 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
Cannot Add an Custom -initWithArg: in a Category?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cannot Add an Custom -initWithArg: in a Category?


  • Subject: Cannot Add an Custom -initWithArg: in a Category?
  • From: Jerry Krinock <email@hidden>
  • Date: Mon, 23 Jan 2006 12:07:57 -0800
  • Thread-topic: Cannot Add an Custom -initWithArg: in a Category?

Is there some reason why I cannot add a custom -initWithArg: method in a
category?  It compiles OK, but gives me a runtime exception "selector not
recognized" when I invoke this method to create an instance.

I have also added a convenience method which invokes this same -initWithArg:
method.  The convenience method works fine.

Jerry Krinock

@interface NSMutableDictionary (BmItem)
    + (NSMutableDictionary*)initWithNodeType:(enum NodeType)nodeType ;
    + (NSMutableDictionary*)bmItemNodeType:(enum NodeType)nodeType ;
    ...
@end

@implementation NSMutableDictionary (BmItem)

+ (NSMutableDictionary*)initWithNodeType:(enum NodeType)nodeType
{
    NSMutableDictionary* newItem = [[NSMutableDictionary alloc] init] ;
    [newItem setNodeType:nodeType] ;
    // Note: nodeType is an entry in the NSMutableDictionary.
    // It is not an instance variable.
    return newItem ;
}

+ (NSMutableDictionary*)bmItemNodeType:(enum NodeType)nodeType
{
    return [[self initWithNodeType:nodeType] autorelease] ;
}

...

@end


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Cannot Add an Custom -initWithArg: in a Category?
      • From: Tomas FranzĂ©n <email@hidden>
  • Prev by Date: Re: NSSound vs QuickTime
  • Next by Date: Re: NSTextField and NSLineBreakByTruncatingMiddle
  • Previous by thread: Re: NSTextView - custom pasteboard types and text table issues
  • Next by thread: Re: Cannot Add an Custom -initWithArg: in a Category?
  • Index(es):
    • Date
    • Thread