Note that there are some explanatory texts on larger screens.

plurals
  1. POIOS 7 error with annotations
    primarykey
    data
    text
    <p>I have an <code>NSMutableArray</code> with map coordinates when I try to use annotation with that information I am getting this error on line annotation.coordinate, it was working on IOS 5 and 6: </p> <blockquote> <p>-[__NSCFArray objectForKeyedSubscript:]: unrecognized selector sent to instance</p> </blockquote> <p>I have this code:</p> <pre><code> NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"URL"]]; NSError *error; NSArray *array = [NSJSONSerialization JSONObjectWithData:data options:0 error:&amp;error]; NSString *value = [array valueForKey:@"cortesMap"]; NSMutableArray *arr = [[NSMutableArray alloc] init]; [arr addObject:value]; if (error) { NSLog(@"%s: error=%@", __FUNCTION__, error); return; } for (NSDictionary *dictionary in arr) { MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init]; annotation.coordinate = CLLocationCoordinate2DMake([dictionary[@"latitude"] doubleValue], [dictionary[@"longitude"] doubleValue]); annotation.title = dictionary[@"type"]; annotation.subtitle = dictionary[@"description"]; [self.mapView addAnnotation:annotation]; } </code></pre> <p>and here is the <code>viewForAnnotation</code>:</p> <pre><code>- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id &lt;MKAnnotation&gt;)annotation { MKAnnotationView *annotationView= nil; if (![annotation isKindOfClass:[MKUserLocation class]]) { static NSString *annotationViewId = @"annotationViewId"; annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:annotationViewId]; if (annotationView == nil) { annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationViewId]; annotationView.canShowCallout = YES; annotationView.image = [UIImage imageNamed:@"pin.png"] } else { annotationView.annotation = annotation; } } return annotationView; } </code></pre>
    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