p254: ItemDetailViewControllerDelegate Implementation..


#1

Hello,

this ItemDetailViewControllerDelegate Implementation… drives me nuts.

Goog thing is: It works!

in ItemsViewController.m gets called. so it can’t be that wrong. but as soon as i declare that i conform to ItemDetailViewControllerDelegate in ItemsViewController.h, the project will not build.

[code]
#import <Foundation/Foundation.h>
#import “ItemDetailViewController.h”

@interface ItemsViewController : UITableViewController <UITableViewDataSource, ItemDetailViewControllerDelegate>
{

}[/code]

this is the protocol implementation from ItemDetailViewController.h:

@class ItemDetailViewController;
@protocol ItemDetailViewControllerDelegate <NSObject>
@optional
-(void)itemDetailViewControllerWillDismiss:(ItemDetailViewController *)vc;
@end

for full reference, find the non-compiling project here: dl.dropbox.com/u/9327964/Homepwner.zip

any ideas?

regards, tobias


#2

Hi,

In your ItemDetailViewController.h file you have #import “ItemsViewController.h”

but ItemsViewController references the ItemDetailViewControllerDelegate protocol which isn’t defined at that point. (You define it a few lines later)

so if you remove the #import ItemsViewController.h (or move it to after the protocol declaration) you should be ok.

HTH
Gareth


#3

Thanks, you are right. That fixed the problem. Man this stuff can get confusing :wink: