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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:34:08+00:00 2026-05-26T05:34:08+00:00

For some reason, when I use [mapView addOverlay:], nothing happens. Code: NSData* dataLat =

  • 0

For some reason, when I use [mapView addOverlay:], nothing happens.

Code:

NSData* dataLat = [[NSUserDefaults standardUserDefaults] objectForKey:@"latKey"];
NSArray* overlayLat = [NSKeyedUnarchiver unarchiveObjectWithData:dataLat];
double lats[overlayLat.count];
NSData* dataLong = [[NSUserDefaults standardUserDefaults] objectForKey:@"longKey"];
NSArray* overlayLong = [NSKeyedUnarchiver unarchiveObjectWithData:dataLong];
double longs[overlayLong.count];

for(int iii = 0; iii < overlayLat.count; iii++)
{
    NSNumber* a = (NSNumber*)[overlayLat objectAtIndex:iii];
    lats[iii] = [a doubleValue];
}

for(int iii = 0; iii < overlayLong.count; iii++)
{
    NSNumber* a = (NSNumber*)[overlayLong objectAtIndex:iii];
    longs[iii] = [a doubleValue];
}

int size = (sizeof(lats) / sizeof(lats[0]));

NSLog(@"%d", size);

MKMapPoint points[size];

for(int iii = 0; iii < overlayLong.count; iii++)
{
    MKMapPoint point = MKMapPointMake(lats[iii], longs[iii]);
    if(lats[iii] != 0)
        points[iii] = point;
}

for(int iii = 0; iii < 15; iii++)
{
    NSLog(@"Lat (x):%f", points[iii].x);
    NSLog(@"Long (y):%f", points[iii].y);
}

MKPolyline* line = [MKPolyline polylineWithPoints:points count:size];

[mapView addOverlay:line];

NSLog(@"finished");

The vast majority of this code just accesses the data and turns it into usable coordinates. My question is (because I know that the coordinates are valid because of the NSLogs), why doesn’t anything get added to the mapView when addOverlay: is called? I can post more code if need be. 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-26T05:34:09+00:00Added an answer on May 26, 2026 at 5:34 am

    The polylineWithPoints:count: method takes a C array of MKMapPoint structs.

    An MKMapPoint is not the same as a CLLocationCoordinate2D (latitude, longitude). You are creating MKMapPoint structs using MKMapPointMake but giving it latitude and longitude values. Such an MKMapPoint is not at the expected location.

    Either use MKMapPointForCoordinate to create an MKMapPoint from lat/long coordinates or, probably easier, create a C array of CLLocationCoordinate2D structs and call polylineWithCoordinates:count: instead.

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

Sidebar

Related Questions

I'm trying to use Python to run pdftotext, but for some reason, my code
for some reason when I use the following code TimeSpan timeDiffUtcServer = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now); it
for some reason , i can't use jquery . this is my code: <!DOCTYPE
in some reason if I use this code it sends the form in normal
Following on from a previous question, for some reason when I use the following
For some reason I can't use runat=server as an attribute for the input tag
For some reason I am not able to use the TextFlow element in WPF.
For some reason, I should use gcc to compile a C file, then link
Can I simply use if(myString == nil) For some reason a string that I
I use K2 as my workflow engine. For some reason my processes are not

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.