简体   繁体   中英

location delegate not firing

I'm trying to get the user location. I added the coreLocation framework, and implamented the start location method and the delegate. The problem that the delegate function just doesn't fired.

LocationManager.h :

@interface LocationManager : NSObject<CLLocationManagerDelegate>

@property(strong,nonatomic)CLLocationManager *locationManager;

-(void)startLocaitonService;

@end

LocationManager.m :

@implementation LocationManager 

-(void)startLocaitonService
{
    _locationManager=[[CLLocationManager alloc]init];
    _locationManager.delegate = self;
    _locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
    _locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
    [_locationManager startUpdatingLocation];

}
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{

}
@end

I'm have a breakpoint in the delegate function but nothing happens

That delegate method was deprecated in iOS 6.0.

From the class reference :

Deprecation Statement

Use locationManager:didUpdateLocations: instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM