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

  • Home
  • SEARCH
  • 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 534689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:38:20+00:00 2026-05-13T09:38:20+00:00

I have a ViewController (with a MKMapView) which is pushed into, because of the

  • 0

I have a ViewController (with a MKMapView) which is pushed into, because of the NavigationController. So I have a NavBar with a “back” button.
Clicking that back-button, I get an error:

2010-01-11 18:05:35.273 TestApp[147:207] An instance 0x1758f0 of class MKUserLocation is being deallocated while key value observers are still registered with it. Observation info is being leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here’s the current observation info:
(
Context: 0x0, Property: 0x17d600>
)
Program received signal: “EXC_BAD_ACCESS”.

I have the viewDidLoad method implemented with an Observer:

- (void)viewDidLoad {
    mapView = (MKMapView*)self.view;
    mapView.delegate = self;
    mapView.mapType = MKMapTypeHybrid;
    mapView.showsUserLocation = YES;

    // ...

    [mapView.userLocation addObserver:self forKeyPath:@"location" options:0 context:NULL];
    [super viewDidLoad];

}

My dealloc:

- (void)dealloc {
    [groupId release];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [super dealloc];
}

Can anyone tell me what’s wrong here? I click the back button in the NavBar and then I come into the dealloc method and then it switches back to the higher ViewController and throws this error.

Thanks a lot in advance & Best Regards.

  • 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-05-13T09:38:20+00:00Added an answer on May 13, 2026 at 9:38 am

    You’re setting and removing an observer on different objects. You are adding the view controller as an observer of the userLocation in the first code sample, then trying to remove it from the default notification center in the second. To properly remove the observer from userLocation, change your -dealloc method to the following:

    - (void)dealloc {
        [groupId release];
        [mapView.userLocation removeObserver:self forKeyPath:@"location"];
        [super dealloc];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 258k
  • Answers 258k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer For starters, your HTML is invalid. A nested ul element… May 13, 2026 at 11:04 am
  • Editorial Team
    Editorial Team added an answer Does the cell textLabel allow autosizing and is lineBreakMode set… May 13, 2026 at 11:04 am
  • Editorial Team
    Editorial Team added an answer If you use constant row width, you can use colspan… May 13, 2026 at 11:04 am

Related Questions

I have a strange(?) crash after releasing MKMapView. MKMapView is a subview in my
I´m trying to use Interface Builder (IB) to gain time in my app development.
I have a UITableView with a list of items. Selecting an item pushes a
Is there a way to pop the view controller when the user switches tabs?
Still an iphone dev starter but trying. I would like to have the user

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.