Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling [mapView addOverlay:] has no effect
    primarykey
    data
    text
    <p>For some reason, when I use [mapView addOverlay:], nothing happens.</p> <p>Code:</p> <pre><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 &lt; overlayLat.count; iii++) { NSNumber* a = (NSNumber*)[overlayLat objectAtIndex:iii]; lats[iii] = [a doubleValue]; } for(int iii = 0; iii &lt; 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 &lt; overlayLong.count; iii++) { MKMapPoint point = MKMapPointMake(lats[iii], longs[iii]); if(lats[iii] != 0) points[iii] = point; } for(int iii = 0; iii &lt; 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"); </code></pre> <p>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!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload