Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8295999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:48:22+00:00 2026-06-08T14:48:22+00:00

I have a tableView with an button to push a mapView. The push and

  • 0

I have a tableView with an button to push a mapView. The push and back actions generally work fine. If I switch quickly between these two views, “EXC_BAD_ACCESS” error will 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);
 // will never enter in to here
}

[self.mapView addAnnotation:self.whereAmIAnnotation];

}

If I comment [self.mapView addAnnotation:self.whereAmIAnnotation]; , there is no “EXC_BAD_ACCESS” anymore.

Any answers and comments will be appreciated. Thanks 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 is declared here:

MapViewController.m

@interface AddrCoordinateAdjustMapViewController()

@property (retain) WhereAmIAnnotation *whereAmIAnnotation;

@end
@implementation MapViewController
@synthesize whereAmIAnnotation;

Edit 4:

Error message is as following:

2012-07-30 15:56:19.735 myApp[13584:707] *** -[MapViewController respondsToSelector:]: message sent to deallocated instance 0x10195e80

It usually crashes when i switch back to the tableView while the annotationView is dropping.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T14:48:24+00:00Added an answer on June 8, 2026 at 2:48 pm

    Have you removed yourself as delegate of the mapview?

    self.mapview.delegate = nil;
    

    try removing it at viewWilldisappear or whenever you consider necessary as you might need it later if you have pushed a view controller and will return to the view later.

    In a nutshell, remove it when your view cannot respond to the delegate which is why you got the EXC_BAD_ACCSS. it sent a message to your view but it was already released from memory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic tableview which has a prototype cell with a button that,
I have a button that when pressed, a tableview section will be added and
Do I have to release a a tableView after pressing a button. The tableView
i am having a tableview with a list of categories.i have an add button
I have a view controller called searchUpdateController , it has a button to push
so basically I have a UITableView and when using it to switch between other
I have used TableView and also used Disclosure Button by clicking on Disclosure Button
I want to push two different view controllers: 1). When tableView is in normal
I have a UI tableView and I am trying to create a button like
I have tableview, where create new rows and set them layout manually. In every

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.