位置代表没有解雇

时间:2014-09-18 21:47:34

标签: ios objective-c core-location

我正在尝试获取用户位置。我添加了coreLocation框架,并填充了起始位置方法和委托。 委托函数不会触发的问题。

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

我在委托函数中有一个断点,但没有任何反应

1 个答案:

答案 0 :(得分:0)

该委托方法在iOS 6.0中已弃用。

来自the class reference

  

弃用声明

     

改为使用locationManager:didUpdateLocations: