gpt4 book ai didi

ios - EXC_BAD_ACCESS 与 GMSMapView

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:55:38 25 4
gpt4 key购买 nike

我有一个 EXC_BAD_ACCESS 让我发疯!!我正在尝试创建一个自定义 GMSCircle,当我分配一个 GMSMapView 实例时,它会导致崩溃...

任何人都可以帮助我,这是代码:

...
@property (nonatomic, strong) GMSMapView *mapView;
@property (nonatomic, strong) PGCRadarCircle *circle;
...
_mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
...
_circle = [PGCRadarCircle radarWithPosition:[PGCLocationManager instance].currentLocation.coordinate
map:_mapView
radius:500];

PGCRadarCircle.h

...
@property (nonatomic, strong) GMSMapView* map;
...

- (id)initWithPosition:(CLLocationCoordinate2D)coordinate map:(GMSMapView*)mapView radius:(CLLocationDistance)radius {
if (self = [super init])
{
self.numberOfPulse = 2;
self.map = mapView;
self.position = coordinate;
self.radius = radius;
self.fillColor = [UIColor colorWithWhite:1.0 alpha:0.5];
self.strokeColor = [UIColor colorWithWhite:0.9 alpha:0.5];
self.strokeWidth = 1;
self.running = false;
self.waves = [[NSMutableArray alloc] init];
self.duration = 2;


GMSCircle *wave = [GMSCircle circleWithPosition:self.position radius:0];
wave.fillColor = _fillColor;
wave.strokeColor = _strokeColor;
wave.strokeWidth = _strokeWidth;
wave.map = _map; <--- EXC_BAD_ACCESS at this line

[_waves addObject:wave];

[self initWaves];
}

return self;
}

堆栈截图:

screenshot

object

谢谢。

最佳答案

此问题可能是因为您的坐标无效,请尝试检查它:

if (CLLocationCoordinate2DIsValid(self.position)) {
wave.map = _map;
}

关于ios - EXC_BAD_ACCESS 与 GMSMapView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38805660/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com