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

  • Home
  • SEARCH
  • 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 6387909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:12:44+00:00 2026-05-25T03:12:44+00:00

I have an MKMapView whose delegate is set in Interface Builder and which is

  • 0

I have an MKMapView whose delegate is set in Interface Builder and which is a retained property (hooked up in Interface Builder as well) of its view controller. Yes, I am sure they are hooked up properly. I am trying to add annotations to the mapView, but mapView: viewForAnnotation: is not called, and after adding all of the annotations with [self.map addAnnotation:annot], printing the count of the mapView’s annotations array yields zero. I have no idea what is causing this because my MapPerson object implements the MKAnnotation protocol with a readonly coordinate property. Here is my code for that business…

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface MapPerson : NSObject <MKAnnotation> {
  CLLocationCoordinate2D _coo;
}

@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;

@end

And its implementation…

#import "MapPerson.h"

@implementation MapPerson

@synthesize coordinate=_coo;

- (id)init
{
    self = [super init];
    if (self) {
        // Initialization code here.
    }

    return self;
}

- (id)initWithCoordinate:(CLLocationCoordinate2D)loc {
  self = [super init];
  if (self) {
    _coo = loc;
  }
  return self;
}

I am trying to create these annotations in a delegate method from a service class which fetches coordinates from a server to the view controller containing the mapView. I have tried moving that code to a helper method which I make sure to call on the main thread, but nothing happens.

- (void)refreshMap {
  for (MapPerson *p in mapPeople) {
    [self.map addAnnotation:p];
  }
  NSLog(@"Mapview has %i annotations.", self.map.annotations.count);
  // is always 1 for the user's location
}

I have Googled and SO’s and looked at several different tutorials which do not differ from my code except in names. I put a breakpoint in mapView: viewForAnnotation:, and it is only called once for the user’s location annotation. The count of mapPeople is 5. Their coordinates are being set correctly. Any ideas?

  • 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-25T03:12:44+00:00Added an answer on May 25, 2026 at 3:12 am

    The backend is using MongoDB which had reversed latitude/longitude. Thus, the annotations were added to a location that doesn’t exist on the coordinate plane of the map. I feel like an idiot for not noticing this sooner. Thanks for the answers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MKMapView with it's delegate set to my controller (m) class. Code
I have an MKMapView which populates the entirety of my view, but when a
I have a MKMapView and in the Map View Show User Location is set.
I have a MKMapView . Sometimes after my view controller is dismissed, I'll get
As well as my question Removing MKMapView Annotations causes leaks. I have discovered that
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons
I have an MKMapView which allows the user to scroll the map around. Later,
I have a detail view that includes three UIButtons, each of which pushes a
I have a UITableView (on a navigation controller stack) which is showing details for
I have a problem using the -(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccesoryControlTapped:(UIControl *)control method. I

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.