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 416767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:30:47+00:00 2026-05-12T18:30:47+00:00

I use the loop below to populate my MapView. However it always shows only

  • 0

I use the loop below to populate my MapView. However it always shows only one pin at a time, no matter how many iterations i do.

Individually declaring items doesn’t seem to have an impact either.

I’m using the initial 3.0 SDK with xCode 3.1.3 on osx 10.5.8, The 3.1 SDK changelog didn’t make any mention of any fixes to the MKMapKit framework, so i haven’t felt the need to download the 2.5GB file.

    for(NSDictionary* dict in results ){
    NSLog(@"Made Annotation  %@ at N%f E%f", [dict valueForKey:@"location"],[dict valueForKey:@"latitude"],[dict valueForKey:@"longitude"] );
    NSLog(@"List of keys %@", dict);

    LTAnnotation* pin = [[LTAnnotation alloc] initWithTitle: [dict valueForKey:@"location"]
                                     latitude: [dict objectForKey:@"latitude"]
                                    longitude: [dict objectForKey:@"longitude"]
    ];

    [MapView addAnnotation: pin];

}

This is output from the first logging statement

Made Annotation  London at N51.3 E0.07000000000000001
Made Annotation  Amsterdam at N52.22 E4.53

And the second is structure of the dictionary

List of keys {
    id = 0;
    latitude = 51.3;
    location = London;
    longitude = 0.07000000000000001;
    time = "12:00-13:00";
}
List of keys {
    id = 1;
    latitude = 52.22;
    location = Amsterdam;
    longitude = 4.53;
    time = "12:00-13:00";
}

In case your interested here’s my implementation of LTAnnotation

@interface LTAnnotation(Private)
    double longitude;
    double latitude;
@end

@implementation LTAnnotation

@synthesize title;
@synthesize subTitle;
-(id) initWithTitle:(NSString*)pTitle latitude:(NSNumber*)latDbl longitude:(NSNumber*) longDbl{
    self = [super init];

    self.title = pTitle;

    latitude = [latDbl doubleValue];
    longitude = [longDbl doubleValue];
    NSLog(@"Create Annotation for %@ at %fN %fE",pTitle,[latDbl doubleValue],[longDbl doubleValue]);
    return self;

}


-(CLLocationCoordinate2D) coordinate
{
    CLLocationCoordinate2D retVal;

    retVal.latitude = latitude;
    retVal.longitude = longitude;

    return retVal; 
}
@end

This all combines to produce this …

alt text http://img340.imageshack.us/img340/3788/picture1fg.png

Any ideas at where i’m going wrong?
Thanks

  • 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-12T18:30:47+00:00Added an answer on May 12, 2026 at 6:30 pm

    Two small things I noticed which might help solve the problem:

    • You are not releasing the pin in the first code sample which would create a leak
    • You are not checking if “self = [super init];” in your second code sample was successful (“if(self = [super init]){…} return self”). The NSLog also only outputs the parameters passed to the init method, not the instance methods of the object

    And most importantly, I just noticed this in your init method:

    latitude = [latDbl doubleValue];
    longitude = [longDbl doubleValue];
    

    You are not using Objective-C 2 style accessor methods (self.latitude = …) and not retaining the autoreleased values. This probably means the variables are disappearing and that’s why you cannot see the annotations, as they don’t have valid coordinates.

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

Sidebar

Ask A Question

Stats

  • Questions 407k
  • Answers 407k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can give a second parameter to your selector to… May 15, 2026 at 6:28 am
  • Editorial Team
    Editorial Team added an answer The object browser will tell you the providing DLL if… May 15, 2026 at 6:28 am
  • Editorial Team
    Editorial Team added an answer Since all writes are cached in the system cache by… May 15, 2026 at 6:27 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.