Protocol Inheritance in Objective-C

I have a project in which there is a protocol, a class implementing this protocol, and a subclass of the implementation class. This is our production application.

@protocol ProductionProtocol<NSObject>
@property (nonatomic, retain) NSString *role;
@end

@interface BaseProduction : NSObject<ProductionProtocol>
NSString *role;
@end

@implementation BaseProduction
@synthesize role;
@end

@interface Production : BaseProduction
@end

@implementation Production
@end

I also have proof of concept (POC), which is implemented as a standalone project that includes a production application. In a POC application, I have a protocol that extends the production protocol and a class that extends the production class.

@protocol POCProtocol<ProductionProtocol>
-(void)cancel;
@end

@interface POC : Production<POCProtocol>
@end

@implementation POC
-(void)cancel{...}
@end

Note that in ProductionProtocol I have an NSString role, which is declared and implemented in the BaseProduction interface / class. in POC, I have a cancel method that is declared in the protocol but not in the interface / class.

So here is my question: with my class structure configured this way, I get this warning:

Property 'role' requires method '-role' to be defined - use @synthesize, @dynamic or provide a method implementation

, . , POC, , , . ?

+5
2

Objective-C, Apple:

, , , . , , . , . , :

  • ,
  • ,

, GCC , . Clang, , , , @dynamic, , ​​ ( , ).

+11

[XCode 3.2]

. POC ProductionProtocol:

  • POCProductionBaseProductionProductionProtocol
  • POCPOCProtocolProductionProtocol

GCC 4.2, Clang (LLVM 1.6, XCode 3.2).

POCProtocol :

@protocol POCProtocol//<ProductionProtocol>

.

TODO , .

, , , - .NET( ( Obj-C) ).

@danyowdee , , Clang ( XCode 4, ), , ..

+1

All Articles