iphone - "EXC_BAD_ACCESS" when switch too fast between an tableView and a mapView -


i have tableview button push mapview. push , actions work fine. if switch between these 2 views, "exc_bad_access" error appear.

mapviewcontroller.m

- (void)viewdidload { [super viewdidload]; self.mapview.delegate = self;      uibutton *btnl = [[uibutton alloc] initwithframe:cgrectmake(0, 0, 40.0, 40.0)]; [btnl setimage:[uiimage imagenamed:@"back.png"] forstate:uicontrolstatenormal]; [btnl addtarget:self.navigationcontroller  action:@selector(popviewcontrolleranimated:) forcontrolevents:uicontroleventtouchdown]; self.navigationitem.leftbarbuttonitem = [[[uibarbuttonitem alloc] initwithcustomview:btnl] autorelease]; [btnl release];  self.whereamiannotation = [[[whereamiannotation alloc] init] autorelease];  if (!self.mapview || !self.whereamiannotation) {     nslog(@"mapview : %@", self.mapview);     nslog(@"whereamiannotation : %@",self.whereamiannotation);  // never enter in here }  [self.mapview addannotation:self.whereamiannotation];  } 

if comment [self.mapview addannotation:self.whereamiannotation]; , there no "exc_bad_access" anymore.

any answers , comments appreciated. in advance!

edit 2

main.m

#import <uikit/uikit.h>  #import "appdelegate.h"  int main(int argc, char *argv[]) { @autoreleasepool {     return uiapplicationmain(argc, argv, nil, nsstringfromclass([appdelegate class]));  // "exc_bad_access" error message shows here } } 

edit 3:

the whereamiannotation declared here:

mapviewcontroller.m

@interface addrcoordinateadjustmapviewcontroller()  @property (retain) whereamiannotation *whereamiannotation;  @end @implementation mapviewcontroller @synthesize whereamiannotation; 

edit 4:

error message following:

2012-07-30 15:56:19.735 myapp[13584:707] *** -[mapviewcontroller respondstoselector:]: message sent deallocated instance 0x10195e80 

it crashes when switch tableview while annotationview dropping.

have removed delegate of mapview?

self.mapview.delegate = nil; 

try removing @ viewwilldisappear or whenever consider necessary might need later if have pushed view controller , return view later.

in nutshell, remove when view cannot respond delegate why got exc_bad_accss. sent message view released memory.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -