Nat! bio photo

Nat!

Senior Mull.

Twitter RSS

Github

@protocol on category at runtime only exists if the category implementation exists

This is somewhat obvious, but anyway:

@protocol Fooble
@end


@interface Foo : NSObject
@end


@implementation Foo
@end


@interface NSObject ( Fooble) < Fooble>
@end


@implementation NSObject ( FoobIe)
@end


void  main()
{
   printf( "%s", [[Foo new] conformsToProtocol:@protocol(  Fooble)] ? "YES" : "NO");
}

will respond with NO, because of the typo in @implementation NSObject ( FoobIe) .