Cannot Add an Custom -initWithArg: in a Category?
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