• 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
Having troubles implementing categories
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Having troubles implementing categories
      • From: Angela Brett <email@hidden>
  • Prev by Date: Re: NSMenu itemAtIndex: problem
  • Next by Date: [SOLVED] popup menus at a specified position
  • Previous by thread: [ANN] TimeDisc - clock app with source
  • Next by thread: Re: Having troubles implementing categories
  • Index(es):
    • Date
    • Thread