I am running with Xcode version 5.1, iOS SDK version 7.1. Here are some sample declarations all in the same file:
@protocol A <NSObject>
@end
@protocol B <A>
@end
@interface SomeObject : NSObject <B>
@end
@interface SomeContainer : NSObject
- (id<A>)pop;
@end
Xcode generates a warning in the following code:
SomeContainer *container = [[SomeContainer alloc] init];
SomeObject *obj = [container pop]; // Warning: Initializing 'SomeObject *__strong' with and expression of incompatible type 'id<A>'
I know that typecasting will get rid of the warning, however, I don't understand why I need it. SomeObject must implement whatever is declared in protocol A. Is there something that I am missing? Any explanation would be greatly appreciated.