0

Annotations are not shown on map.what could be the reason ? pls help.i cannot see any Pin or Annotations on the map,it is showing area near portugal,spain etc.

addressArray = dictionary[@"data"][@"centers"];
NSArray *latitude =[dictionary[@"data"][@"centers"]valueForKey:@"lat"];
NSArray *longitude=[dictionary[@"data"][@"centers"]valueForKey:@"lng"];
NSString *cname=[dictionary[@"data"][@"centers"]valueForKey:@"category_name"];
loaderView.hidden = true;
NSLog(@"%@",latitude);
NSLog(@"%@",longitude);
NSLog(@"%@",cname);
UIImage *pinImage = [UIImage imageNamed:@"map_gym"];
GMSMarker *mark=[[GMSMarker alloc]init];
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([[latitude objectAtIndex:0] doubleValue] ,[[longitude objectAtIndex:0] doubleValue]);
NSLog(@"%@",[latitude objectAtIndex:0]);
NSLog(@"%@",[longitude objectAtIndex:0]);
mark.position =coord;
mark.title=cname;
mark.icon=pinImage;
mark.infoWindowAnchor = CGPointMake(0.5, 0.25);
mark.groundAnchor = CGPointMake(0.5, 1.0);
mark.map=_mapView;
Shikha Sharma
  • 139
  • 1
  • 14

1 Answers1

0

I think the coordinates of the marker is not properly implemented. Take a look at the code sample in Google's Document.

CLLocationCoordinate2D position = CLLocationCoordinate2DMake(10, 10);
GMSMarker *marker = [GMSMarker markerWithPosition:position];
marker.title = @"Hello World";
marker.map = mapView_;

Try adjusting your code to this.

E.g.

CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([[latitude objectAtIndex:0] doubleValue] ,[[longitude objectAtIndex:0] doubleValue]);
GMSMarker *marker = [GMSMarker markerWithPosition:coord];
marker.title = @"Hello World";
    marker.map = mapView_;
Mr.Rebot
  • 6,703
  • 2
  • 16
  • 91