1

當我用導航控制器在新的視圖中打開MapView,然後不等待地圖加載,然後單擊後退按鈕 - 我拋出異常。任何人都可以確認嗎?什麼是解決方法?MKMapView中的錯誤?

回答

4

您是否在釋放導航控制器時釋放mapview?

這可能是在代理髮布之後,mapview正在向其委託(您的導航控制器)發送消息。

嘗試在發佈之前將mapview的委託設置爲零。

1

我有這個確切的錯誤。

它是由你的類中的一些委託方法引起的,一旦你彈出那個類並且地圖忙於做它試圖調用留下內存的類的東西。

我只是簡單地添加

- (void)dealloc 
{ 
    // release the map delegate otherwise it will try and call our classes with no data. 
    // map for me is my MKMapView 
    map.delegate = nil; 
    [super dealloc]; 
}