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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:04:08+00:00 2026-06-07T15:04:08+00:00

in .h file #import <MapKit/MapKit.h> @interface FirstViewController : UIViewController <MKMapViewDelegate,MKReverseGeocoderDelegate,CLLocationManagerDelegate> { } in .m

  • 0

in .h file

#import <MapKit/MapKit.h>
@interface FirstViewController : UIViewController <MKMapViewDelegate,MKReverseGeocoderDelegate,CLLocationManagerDelegate>
{

}

in .m file

-(void)viewDidLoad
{
    CLLocationManager *locationManager = [[[CLLocationManager alloc] init] autorelease];
    locationManager.delegate = self;
    locationManager.distanceFilter = kCLDistanceFilterNone;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    [locationManager startUpdatingLocation];

    [super viewDidLoad];
}


- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation 
{
     MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate];
     geoCoder.delegate = self;
     [geoCoder start];
}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 
{
     NSLog(@"locationManager:%@ didFailWithError:%@", manager, error);
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
     MKPlacemark * myPlacemark = placemark;

     NSString *kABPersonAddressCityKey;
     NSString *city = [myPlacemark.addressDictionary objectForKey:(NSString*) kABPersonAddressCityKey];

     lblAddress.text = city;

     NSLog(@"city detail is:--> %@",city);
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
    NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error);
}

This is the code which I have done to get the current location of user & print it in the label.

But the CLLocationManager delegate method (which are written above) is not called & I am not able to get the current address.

Please help me out.

Where I am doing mistake…? guide me.

Thanks.

  • 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-07T15:04:10+00:00Added an answer on June 7, 2026 at 3:04 pm

    Instead of autoreleasing the CLLocationManager instance, assign it to an ivar in your class. Then release it in -dealloc as usual (or in one of the delegate methods if you don’t need it any longer).

    I suspect your location manager is getting deallocated on the next turn of the run loop before having an opportunity to fire off its delegate methods.

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

Sidebar

Related Questions

I'm declaring: CCSprite+DisableTouch.h file #import cocos2d.h @interface CCSprite (DisableTouch) <CCTargetedTouchDelegate> { } -(void)disableTouch; -(void)enableTouch;
I have following code in .h file #import <UIKit/UIKit.h> @interface MessDisViewController : UIViewController {
I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface
Here is my header file #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import <PolygonShape.h> @interface Controller :
Following is my code: .h file: #import Foundation/Foundation.h @interface GObject:NSObject{ NSTimer* m_Timer; } @property(nonatomic,
I have the following code (where an error appears): .h file #import <Foundation/Foundation.h> @interface
//viewController.h file //--------------------- #import <UIKit/UIKit.h> @interface ItemClass : NSObject { NSString* name; } @property
Please help; Header File #import <Foundation/Foundation.h> @interface MyClass : NSObject { NSMutableString * myString;
In Objective-c, I have variables set in the interface file: #import <Cocoa/Cocoa.h> @interface TestApp_BotAppDelegate
MPPopoverControllerDelegate.h file #import <Foundation/Foundation.h> @class MPPopoverController; @protocol MPPopoverControllerDelegate <NSObject> @optional - (void)popoverControllerDidDismissPopover:(MPPopoverController *)popoverController; @end

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.