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 6211659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:22:38+00:00 2026-05-24T06:22:38+00:00

I guess error is too strong as it works exactly like I want it

  • 0

I guess error is too strong as it works exactly like I want it to, but I am getting a warning message that is troubling. I am adding a UIViewController to a TabBarController and all I want it to do is display the Map View and then zoom in on the user when the user clicks on that tab. I built the xib and the only editing I did was to drag an MKMapView over and hook up the outlet, as well as the delegate. Other than that, this is all the implementation code:

- (void)viewDidLoad
{

    [super viewDidLoad];

    [mapView setShowsUserLocation:YES];

}

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {

    CLLocationCoordinate2D loc = [userLocation coordinate];
    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 250, 250);
    [mapView setRegion:region animated:YES];

}

The problem is that I am getting a yellow alarm error on the final line that says, “Local declaration of “mapView” hides the instance variable.”

However, when I run the app, it seems to be working correctly. What could this error be referring to?

  • 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-24T06:22:39+00:00Added an answer on May 24, 2026 at 6:22 am

    This is happening because you declared your MKMapView object as mapView. Look at the method declaration:

    - (void)mapView:(MKMapView *)mapView

    it uses the same name as your own variable. This is where the compiler seems to run into a problem. I’ve had this a couple of times myself now, and my solution was to change my variable name (you could use worldView, for example).

    I think you could also solve it with self. Like in other languages, you would use this.variableName, I think you can do self.variableName to indicate that this one is ‘your’ variable. If that makes sense?

    When I declare my own methods, I usually do like this:

     - (void)feedDog:(Dog *)aDog;
    

    and then my variable would be called Dog to avoid confusion.

    Just what I do. If anyone has anything to add to this, feel free to. I’m still fairly new to this, but I did run into this error a couple of times now.

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

Sidebar

Related Questions

Guess that I have a TextView that I want to update it in some
I am continuously calling an API and keep getting Stack level too deep error
I've got this 500 Internal Server Error - LogicException: Unable to guess how to
I guess that the difficult part is the source. Do you know any webpage
I guess getView() is called for each item of the list, but my question
I guess the problem is that I do not know how to use factory
I guess this is a simple question. I need to do something like this:
I was writing a console application that would try to guess a number by
I'm looking for a forward error-correcting code that is relatively easy/fast to encode on
This sounds like a relatively simple question, but I haven't been able to get

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.