Search code examples
iosobjective-cobjective-c-category

Using self keyword from a category


I have an implementation like the following:

@implementation foo (bar)
- (NSAttributedString *) method1
{
  ...
  [self bar: ...]
  ...
}
+(void) bar:...
{
  ...
}

The error is that is says "No visible @interface for foo declares the selector bar:.."

What am I doing wrong?


Solution

  • bar is a class method, use [foo bar] instead.