MKMapView处理

Vla*_*mir 3 iphone crash mkmapview

释放MKMapView后,我发生了一次奇怪的(?)崩溃.MKMapView是我的视图控制器中的一个子视图,在我从导航堆栈中删除该视图并释放它后,应用程序崩溃:

...
#4  0x34196dc8 in -[MKMapView(UserPositioningInternal) locationManagerFailedToUpdateLocation:withError:]
#5  0x3417030c in -[MKLocationManager _reportLocationFailureWithError:]
#6  0x3416de94 in -[MKLocationManager locationManager:didFailWithError:]
#7  0x3205f538 in -[CLLocationManager onClientEventLocation:]
#8  0x3205dd5c in -[CLLocationManager onClientEvent:supportInfo:]
...
Run Code Online (Sandbox Code Playgroud)

处理我的视图时是否必须执行一些额外的步骤?

编辑: 在控制器的dealloc方法中将mapView.showsUserLocation设置为NO似乎有所帮助.问题仍然是 - 它是否有意?

bpa*_*apa 10

在dealloc中,在释放mapView之前将其委托设置为nil.

另外,如果你使用像ReverseGeocoder和CLLocationManager这样的东西,你可能也想做同样的事情.