0

I want to remove warnings from an older project that somebody else has written.

I am confronted with over 200+ warnings about an instance method in a category overrides a method from class.


So for example:

In header:

@interface Foo : NSObject
    //...unimportant code
@end

@interface Foo()
    @property(nonatomic, retain)NSArray *bar;
@end

@interface Foo (Private)
    //...unimportant code
@end

In body:

@implementation Foo
    //...unimportant code
@end

@implementation Foo (Private)
- (NSArray*)bar
{
    //...
}
@end

Generated linker waring:

ld: warning: instance method 'bar' in category from Foo.o overrides method from class in Foo.o


So obviously the getter for the bar property is implemented in the wrong category.

I can solve the problem if I copy the method in the category above.

But do I have to do this manually in over 200 classes?

Or does a refactoring tool for this problem exist or does a flag for the linker exist to suppress exactly this type of warning?

Georges
  • 335
  • 2
  • 13
  • What happens when you change the private declaration to look like `@interface Foo()` and move the private implementation into the (public) `@implementation` section? – trojanfoe Nov 13 '13 at 10:18
  • This works too, but also here it would take a long time to change the 200+ classes by hand. – Georges Nov 13 '13 at 10:29

0 Answers0