In my application i have integrated a view controller like container (split view). Controller view controller container two view. Detail view and selection view(table view).
While selecting the table cell i need to load the MKAnnotation in MKMap view. It is working fine while tapping the cell normally. If we select the cell from the selection table view simultaneously(randomly selecting the cell faster) application crash. I am sure the crash is due to this Annotation code only. Here is my code.
Class for Annotation :
@interface AddressAnnotation : NSObject<MKAnnotation> {
CLLocationCoordinate2D coordinate;
}
-(id)initWithCoordinate:(CLLocationCoordinate2D) c;
@end
@implementation AddressAnnotation
@synthesize coordinate;
- (NSString *)subtitle{
return nil;
}
- (NSString *)title{
return nil;
}
-(id)initWithCoordinate:(CLLocationCoordinate2D) c{
coordinate=c;
return self;
}
@end
Code for adding annotation in detail view:
detail.h
AddressAnnotation *addAnnotation;
detail.m
CLLocationCoordinate2D coordinate;
coordinate.latitude = [self.latitude intValue];
coordinate.longitude = [self.longitude intValue];
[self.mapView setUserInteractionEnabled:NO];
addAnnotation = [[AddressAnnotation alloc] initWithCoordinate:coordinate];
[self.mapView addAnnotation:addAnnotation];
as i said its working fine in normal case, App crash if we select the cell simultaneously. Guide me to fix this issue.
thanks.