Having troubles implementing categories
Having troubles implementing categories
- Subject: Having troubles implementing categories
- From: Michael Norris <email@hidden>
- Date: Mon, 11 Nov 2002 20:11:01 +1300
Apologies for this really newbie question, but I'm trying to get my
head around the categories implementation in Objective-C. I'm
implementing two new methods for the "NSMutableAttributedString" class.
I have two separate files for this: NSMutableAttributedStringGrep.h & .m
Below is the source code that builds OK, but doesn't work.
1) In NSMutableAttributedStringGrep.h I have:
#import <Foundation/NSAttributedString.h>
@interface NSMutableAttributedString (GrepMethods)
-(void)grepOnString:(NSString *)findStr replaceWith:(NSString
*)replaceStr;
-(void)checkFirstChar:(NSString *)checkStr replaceWith:(NSString
*)replaceStr;
@end
2) In NSMutableAttributedStringGrep.m I have:
#import "NSMutableAttributedStringGrep.h"
#import <OmniFoundation/OFRegularExpression.h>
#import <OmniFoundation/OFRegularExpressionMatch.h>
#import <Foundation/Foundation.h>
@implementation NSMutableAttributedString (GrepMethods)
-(void)grepOnString:(NSString *)findStr
replaceWith:(NSString *)replaceStr
{
//code in here
}
-(void)checkFirstChar:(NSString *)findStr
replaceWith:(NSString *)replaceStr
{
//code in here
}
@end
3) And in my App Controller I have:
#import "NSMutableAttributedStringGrep.h"
//etc...
- (void)doTheClean:(NSMutableAttributedString *) myStr
{
[myStr checkFirstChar:@"a" replaceWith:@"b"];
}
However, whenever it gets to this last line, the program halts
execution and gives the following errors:
2002-11-11 20:06:48.521 TypographicText X[2074] *** -[NSIdEnumerator
checkFirstChar:replaceWith:]: selector not recognized
2002-11-11 20:06:48.528 TypographicText X[2074] *** -[NSIdEnumerator
checkFirstChar:replaceWith:]: selector not recognized
In other words, my categories haven't gone in right... why not?
-mike
_______________________________________________
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.