Cannot find MKAnnotation protocol declaration

The code:

@interface RouteMapAnnotation : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString* title; NSString* subtitle; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, copy) NSString* title; @property (nonatomic, copy) NSString* subtitle; @end 

Here is a snapshot of the error that I have:

https://skitch.com/kuntul/rws3c/smartrek-routemapannotation.h

What's wrong? I did this on the exact same project, and it works.

+8
objective-c iphone mkannotation
source share
4 answers

Do you remember #import <MapKit/MapKit.h> ?

+11
source share

Have you imported MKAnnotation.h?

+2
source share

You forgot #import <MapKit/MapKit.h> .

There is no other reason why this may occur.

+2
source share

Just insert one line

#import <MapKit / MapKit.h>

0
source share

All Articles