2012-07-03 23 views
0

我使用一些MKAnnotation設置了一個地圖。當我將它們添加到地圖中時,我收到此消息:使用ARC時Xcode中的重新分配錯誤

ENTAnottation類的實例0xbe62850被釋放,而鍵值觀察者仍在其中註冊。觀察信息被泄露,甚至可能被錯誤地附加到其他物體上。在NSKVODeallocateBreak上設置一個斷點,在調試器中停止。下面是當前觀測信息: ( 語境:爲0x0,屬性:0xbe66b30>

如果我沒有記錯的話,這意味着,雖然他們的觀察者仍然活着的對象已釋放我怎麼能知道至極的觀察者?即使我發現它們...不明確的ARC分配禁止分配如果這是真的,我不能釋放它們...所以...我能做什麼?

謝謝

-------編輯------

根據要求,我發佈我的代碼。我打電話給一個web臨時工牛逼返回我,我需要把我的註解值的JSON:

- (void)requestFinished:(ASIHTTPRequest *)request 
{ 
responseString = [request responseString]; 
id jsonObject = [responseString objectFromJSONString]; 
NSLog(@"From the JSON: %@", responseString); 
NSMutableArray *lat = [jsonObject valueForKeyPath:@"latitud"]; 
NSMutableArray *lon = [jsonObject valueForKeyPath:@"longitud"]; 
NSMutableArray *azafatas = [jsonObject valueForKeyPath:@"azafata"]; 
NSMutableArray *usernames = [jsonObject valueForKeyPath:@"username"]; 
NSMutableArray *mapazafatas=[[NSMutableArray alloc]init]; 
for(int i=0;i<[lat count]; i++) 
{ 
    ENTAnottation *azafata=[[ENTAnottation alloc]init]; 
    double latidouble=[[lat objectAtIndex:i]doubleValue]; 
    double longdouble=[[lon objectAtIndex:i]doubleValue]; 
    CLLocationDegrees lati=latidouble; 
    CLLocationDegrees longi=longdouble; 
    CLLocationCoordinate2D coords=CLLocationCoordinate2DMake(lati, longi); 
    NSString *nombre=[azafatas objectAtIndex:i]; 
    NSString *email=[usernames objectAtIndex:i]; 
    azafata.coordinate=coords; 
    azafata.title=nombre; 
    azafata.username=email; 
    [mapazafatas addObject:azafata]; 
    //[mapa addAnnotation:azafata]; 
} 
for (int i=0;i<[mapazafatas count];i++) 
{ 
    [mapa addAnnotation:[mapazafatas objectAtIndex:i]]; 
} 
} 

之後,應用程序崩潰,儘管它通過我的代碼沒有任何問題。

+0

郵政編碼,內存地址不能幫助任何事情... – graver

+0

發現這一點,以防某人遇到同樣的問題,我有(不是好消息)http://stackoverflow.com/questions/6804900 /可能蝽合的MKMapView – Fustigador

回答

0

已解決。很顯然,如果你傳遞了一對不可能的座標,那麼它就會向你的臉上拋出非常明顯的,不可能混淆的錯誤信息。可憐我...