Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6086985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:49:07+00:00 2026-05-23T11:49:07+00:00

I know there was a question about this before. However, I think a little

  • 0

I know there was a question about this before. However, I think a little bit noob because I can’t get it solved.

I’m getting that error when trying this:

MKAnnotation *annotation = [[MKAnnotation alloc] initWithCoordinate:coordenada title:@"HELLO!"];
[mapa addAnnotation:annotation];

I also have the following method:

- (MKAnnotationView *) mapView: (MKMapView *) mapView viewForAnnotation: (id<MKAnnotation>) annotation
{
    MKPinAnnotationView *pin = (MKPinAnnotationView *) [self.mapa dequeueReusableAnnotationViewWithIdentifier: @"asdf"];
    if (pin == nil)
    {
        pin = [[[MKPinAnnotationView alloc] initWithAnnotation: annotation reuseIdentifier: @"asdf"] autorelease];
    }
    else
    {
        pin.annotation = annotation;
    }
    pin.pinColor = MKPinAnnotationColorRed;
    pin.animatesDrop = YES;
    return pin;
}

And did the #import < MapKit/MKAnnotation.h> in header.

Any help please?

Thank you very much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:49:08+00:00Added an answer on May 23, 2026 at 11:49 am

    MKAnnotation is a protocol, not a class that you can instantiate.

    Have you defined your own class that implements MKAnnotation and a initWithCoordinate:title: method? If you have, use that class name and import its header file.

    If you haven’t created your own annotation class, you’ll have to create one or you can use the pre-defined MKPointAnnotation class (in iOS 4+) instead:

    MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
    annotation.coordinate = coordenada;
    annotation.title = @"HELLO!";
    [mapa addAnnotation:annotation];
    [annotation release];
    

    You’ll also need to do the following:

    • add the MapKit framework to the project
    • add #import <MapKit/MapKit.h> at the top of the file
    • set the delegate property (or outlet in IB) of the map view otherwise viewForAnnotation won’t get called
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there is already a question about this but my issue is more
I know there's no one answer to this question, but I'd like to get
This is a bit of a crazy question, but does anyone out there know
I know that this question is being asked before but I did not get
I know there is a question about that, but there isn't any good answer(for
I know there is no such thing as a dumb question but this is:
I know there is this question that is very similar, but I wanted to
OK, I know there have already been questions about getting started with TDD ..
NOTE: I know there are many questions that talked about that but I'm still
I know there have been questions in the past about SQL 2005 versus Lucene.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.