DisplayMap.h誰かがこのコードのリークを指摘できますか?
#import <Foundation/Foundation.h>
#import <MapKit/MKAnnotation.h>
@interface DisplayMap : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@end
DisplayMap.m
#import "DisplayMap.h"
@implementation DisplayMap
@synthesize coordinate,title,subtitle;
-(void)dealloc{
[title release];
[super dealloc];
}
@end
私は注釈を表示するには、マップビューで上記を実装しています。 viewdidload上で、私は座標のセットを実行し、上記の注釈クラスを使用してマップ上に表示します。
for(int i=0;i<[xmlParameter count];i++){
region.center.latitude=(double)[[[xmlParameter objectAtIndex:i]objectAtIndex:3] doubleValue];
region.center.longitude =(double) [[[xmlParameter objectAtIndex:i]objectAtIndex:4] doubleValue] ;
region.span.longitudeDelta = 0.08f;
region.span.latitudeDelta = 0.08f;
DisplayMap *ann = [[DisplayMap alloc] init];
ann.title = [[xmlParameter objectAtIndex:i]objectAtIndex:0];
ann.subtitle = [[xmlParameter objectAtIndex:i]objectAtIndex:1];
ann.coordinate = region.center;
[mapView addAnnotation:ann];
if(i==zoomtoParameter){
[mapView setRegion:region animated:YES];
//showAnnotation=ann;
[mapView selectAnnotation:currentAnnotation animated:YES];
//[mapView selectAnnotation:ann animated:YES];
}
[ann release];
}
リークのある計測器で動作すると、viewDidLoadメソッドの32ByteのDisplayMapリークがあると言われています。私は方法を理解することはできません。私はそれを行った直後にDisplayMapオブジェクトを解放しています。
提案がありますか?
おかげ
あなたの 'dealloc'に' subtitle'も公開してみてください。 – Mahesh
あなたはタイトルを公開しましたが、どこに割り当てましたか? –