[英]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.
我添加了coreLocation框架,并添加了起始位置方法和委托。 The problem that the delegate function just doesn't fired.
委托函数只是没有触发的问题。
LocationManager.h : LocationManager.h:
@interface LocationManager : NSObject<CLLocationManagerDelegate>
@property(strong,nonatomic)CLLocationManager *locationManager;
-(void)startLocaitonService;
@end
LocationManager.m : 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. 该委托方法在iOS 6.0中已弃用。
From the class reference : 从类参考 :
Deprecation Statement
弃用声明
Use
locationManager:didUpdateLocations:
instead.请改用
locationManager:didUpdateLocations:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.