0
我正在嘗試獲取用戶位置。我添加了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
我在委託函數斷點,但什麼也沒發生
什麼版本的iOS? – trojanfoe 2014-09-18 21:50:02
7.1版本@trojanfoe – 2014-09-18 21:52:28