views:

171

answers:

2

I just resolved a cyclic dependency problem by using class forwarding. Now, I am getting a warning of no 'showSumDetails' method found. I don't understand why it should happen at all, any help will be appreciated. Including a bit of code here:

MyAnnotation.h

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
//#import "MyMapViewController.h" obviously this wasn't possible :-(
@class MyMapViewController;

@interface MyAnnotation : NSObject<MKAnnotation> {


    MyMapViewController* mapController;
}

MyMapViewController.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <MapKit/MKReverseGeocoder.h>
#import "MyAnnotation.h"

@interface MyMapViewController : UIViewController <MKMapViewDelegate>{

    MyAnnotation *annot;
}

MyMapViewController.m - where the method actually exists, and it is defined in the header file as well.

 @implementation MyMapViewController

    @synthesize annot; 

    -(void) showSumDetails:(id)aSumData{
    NSLog(@"mapViewController-showSumDetails");
    SumDetailsViewController *wrController = [[SumDetailsViewController alloc] init];
    wrController.sumData = aSumData;
    [self.navigationController pushViewController:wrController animated:YES];//This needs to be pushed
    [wrController release];
}
@end

But the following method in MyAnnotation.m can't find the method above :-(

@implementation MyAnnotation

@synthesize sumData;
@synthesize mapController;    

- (void) showPD{//is also defined in header file
        NSLog(@"sPD - MyAnn");

        [mapController showSumDetails:sumData]; //This doesn't have a clue about showSumDetails method- Why??
    }

I'd be glad to provide any more info. Please help!!!

A: 

Did you import MyMapViewController.h in MyAnnotation.m?

Since you're using a forward reference for MyMapViewController in MyAnnotation.h you need to import MyMapViewController.h in MyAnnotation.m.

Rob Jones
Thanks I did now and that removes the warning but it still does not reach the showSumDetails method.
UVT
A: 

I also cant reach the method any help?

Nay I just changed the code so that I don't need the method anymore
UVT