title: Trouble creating a custom annotation class in ios
body: <p>I'm trying to make a custom MKAnnotation class so it can hold additional information but i keep getting this error : </p>
  
  <pre><code>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-    [AnnotationForId setCoordinate:]: unrecognized selector sent to instance 0x16f63340'
  </code></pre>
  
  <p>I've tried looking up how to create one and i've followed what i've found online and i'm confused at why i keep getting this error.</p>
  
  <p>Here is my custom annotation class. </p>
  
  <pre><code>#import &lt;MapKit/MapKit.h&gt;
  #import &lt;UIKit/UIKit.h&gt;
  
  @interface AnnotationForId : NSObject &lt;MKAnnotation &gt;{
      NSString *title;
      NSString *subtitle;
      CLLocationCoordinate2D coordinate;
      NSInteger shopId;
  }
  @property(nonatomic)NSInteger shopId;
  @property (nonatomic,  copy) NSString * title;
  @property (nonatomic, copy) NSString * subtitle;
  @property (nonatomic, readonly) CLLocationCoordinate2D  coordinate;
  @end
  </code></pre>
  
  <p>I've synthesized the property variables in .m class. </p>
  
  <p>I try to call the custom class in my main controller: </p>
  
  <pre><code>for(Shop *shops in feed.shops){
          NSLog(@"reached");
          AnnotationForId *shop = [[AnnotationForId alloc] init];
          CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(shops.latitude, shops.longitude);
          shop.coordinate = coords;
          //[[CLLocationCoordinate2DMake(shops.latitude, shops.longtitude)]];
          shop.title = shops.name;
          shop.subtitle = @"Coffee Shop";
          [map addAnnotation:shop];
      }
  </code></pre>
  
  <p>Any help to why this isnt working would be awesome. 
  Thanks.</p>