Why doesn't Xcode 4 give a warning about my incomplete implementation of the UITableViewDataSource protocol?

If I declare and do not fully implement my own protocol, using the following code in Xcode:

SomeProtocol.h:

@protocol SomeProtocol <NSObject> @required -(void)someRequiredMethod; @end 

SomeImplementor.h:

 #import "SomeProtocol.h" @interface SomeImplementor : NSObject <SomeProtocol> @end 

SomeImplementor.m:

 #import "SomeImplementor.h" @implementation SomeImplementor { // I get a warning on this line } @end 

Xcode then issues a warning in the @implementation SomeImplementor.h line, which reads as follows:

Incomplete implementation.

The 'someRequiredMethod' method is not implemented in the protocol.

However, if I do not fully implement the UITableViewDataSource protocol from UITableView.h with the following code ...

SomeClass.h:

 @interface SomeClass : NSObject <UITableViewDataSource> @end 

SomeClass.m:

 #import "SomeClass.h" @implementation SomeClass { // I think I should get a warning here, but I don't } @end 

... then Xcode does a great job of this and doesn’t issue a warning anywhere, although I obviously haven’t implemented the following methods from the UITableViewDataSource protocol:

 @protocol UITableViewDataSource<NSObject> @required - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; // Row display. Implementers should *always* try to reuse cells by setting each cell reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier: // Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 

Why? I see no reason why these two cases should be treated differently. (And I want my warnings!)

+5
ios objective-c cocoa-touch xcode uitableview
source share
1 answer

This is probably a bug in Xcode 4.

It seems to be fixed in Xcode 5, which warns you accordingly.

+3
source share

All Articles