quantumpotato
quantumpotato

Reputation: 9767

Bad access displaying circle on Google Map

the c.map = self.map line fails with EXC_BAD_ACCESS.

From documentation:

/**
 * The map this overlay is on. Setting this property will add the overlay to the
 * map. Setting it to nil removes this overlay from the map. An overlay may be
 * active on at most one map at any given time.
 */
@property(nonatomic, weak) GMSMapView *GMS_NULLABLE_PTR map;

- (void)showResult:(GMSPlace *)place {
    self.place = place;

    GMSCameraPosition *position = [[GMSCameraPosition alloc] initWithTarget:place.coordinate zoom:16 bearing:0 viewingAngle:0];
    [self.map setCamera:position];

    GMSCircle *c = [[GMSCircle alloc] init];
    c.radius = 75 * 1609.344;
    c.fillColor = [UIColor blueColor];
    c.map = self.map;

}

Upvotes: 0

Views: 122

Answers (1)

Nirav D
Nirav D

Reputation: 72440

You need to specify the position of GMSCircle with CLLocationCoordinate2D like this

c.position = coordinate; // Some CLLocationCoordinate2D position
c.map = self.map

Also give fillColor with less alpha so it display map also.
Hope this will help you.

Upvotes: 2

Related Questions