码迷,mamicode.com
首页 > 其他好文 > 详细

CLLocationManager的相关属性讲解

时间:2015-08-14 19:16:13      阅读:2414      评论:0      收藏:0      [点我收藏+]

标签:ios   cllocation   cllocationmanager   定位管理器   苹果官方   

 下面是有关CLLocationManager的定义的翻译,

 //用来设置该用户是否可以使用这个定位的服务,如果设置为no,即为不可以使用,那么程序会尝试调用其他的coreLocation API
+ (BOOL)locationServicesEnabled

 //判断当前的设备是否支持方向的请求
+ (BOOL)headingAvailable

//判断设备是否支持重要位置变化的监测
+ (BOOL)significantLocationChangeMonitoringAvailable

 //确定设备是否支持指定区域的监视。
+ (BOOL)isMonitoringAvailableForClass:(Class)regionClass

//被isMonitoringAvailableForClass替代了
+ (BOOL)regionMonitoringAvailable ;

 //被+isMonitoringAvailableForClass 和 +authorizationStatus替代了
+ (BOOL)regionMonitoringEnabled ;

 //判断设备是否支持范围,这个和支持区域有设么区别
+ (BOOL)isRangingAvailable;


 //返回应用程序当前授权的状态
+ (CLAuthorizationStatus)authorizationStatus ;

//授权状态的种类,这几种授权可以相应的去尝试
typedef NS_ENUM(int, CLAuthorizationStatus) {
    kCLAuthorizationStatusNotDetermined = 0,
    kCLAuthorizationStatusRestricted,
    kCLAuthorizationStatusDenied,
    kCLAuthorizationStatusAuthorizedAlways NS_ENUM_AVAILABLE(NA, 8_0),
    kCLAuthorizationStatusAuthorizedWhenInUse NS_ENUM_AVAILABLE(NA, 8_0),
    kCLAuthorizationStatusAuthorized NS_ENUM_DEPRECATED(10_6, NA, 2_0, 8_0, "Use kCLAuthorizationStatusAuthorizedAlways") = kCLAuthorizationStatusAuthorizedAlways
};

//定位代理
@property(assign, nonatomic) id<CLLocationManagerDelegate> delegate;

//服务是否可用,不过已经过时了,现在都是用类的方法,可以查看上在上面第一个类方法
@property(readonly, nonatomic) BOOL locationServicesEnabled;

@property(copy, nonatomic) NSString *purpose;

@property(assign, nonatomic) CLActivityType activityType;

//距离过滤器
//定义了距离移动的最小距离就可以发生的移动
@property(assign, nonatomic) CLLocationDistance distanceFilter;
eg:_locationManager.distanceFilter = 1000.0f;
由上面可以知道,距离最小为1000米

//用于设置精确度,具体了解可以看CLlocation类
@property(assign, nonatomic) CLLocationAccuracy desiredAccuracy;
extern const CLLocationAccuracy kCLLocationAccuracyBestForNavigation //这一般用于车载导航
extern const CLLocationAccuracy kCLLocationAccuracyBest;  //
extern const CLLocationAccuracy kCLLocationAccuracyNearestTenMeters;
extern const CLLocationAccuracy kCLLocationAccuracyHundredMeters;  //徒步比较合适
extern const CLLocationAccuracy kCLLocationAccuracyKilometer;
extern const CLLocationAccuracy kCLLocationAccuracyThreeKilometers;
eg:    _locationManager.desiredAccuracy = kCLLocationAccuracyBest;
即为要求的精度为最好的。

@property(assign, nonatomic) BOOL pausesLocationUpdatesAutomatically __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_6_0);

@property(readonly, nonatomic, copy) CLLocation *location;


@property(readonly, nonatomic) BOOL headingAvailable __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA,__MAC_NA,__IPHONE_3_0,__IPHONE_4_0);

@property(assign, nonatomic) CLLocationDegrees headingFilter __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);

@property(assign, nonatomic) CLDeviceOrientation headingOrientation __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);


@property(readonly, nonatomic, copy) CLHeading *heading __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);

@property (readonly, nonatomic) CLLocationDistance maximumRegionMonitoringDistance __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);

@property (readonly, nonatomic, copy) NSSet *monitoredRegions __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_0);

@property (readonly, nonatomic, copy) NSSet *rangedRegions __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_7_0);


- (void)requestWhenInUseAuthorization __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_8_0);//使用的时候验证
- (void)requestAlwaysAuthorization __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_8_0);//总是验证
//上面的两个方法就是ios8之后设置的用于验证,也就是每一次打开访问的时候,都是应该验证,才可以访问,否则有些事违法的。



//开始启动定位服务
- (void)startUpdatingLocation;

//与上面对应的停止定位服务
- (void)stopUpdatingLocation;

//开始方向的定位,好像是在汽车的陀螺仪中使用到
- (void)startUpdatingHeading;

//停止方向的定位
- (void)stopUpdatingHeading ;


- (void)dismissHeadingCalibrationDisplay;

- (void)startMonitoringSignificantLocationChanges;

- (void)stopMonitoringSignificantLocationChanges;

- (void)startMonitoringForRegion:(CLRegion *)region
                 desiredAccuracy:(CLLocationAccuracy)accuracy;

- (void)stopMonitoringForRegion:(CLRegion *)region;


- (void)startMonitoringForRegion:(CLRegion *)region ;
- (void)requestStateForRegion:(CLRegion *)region;

- (void)startRangingBeaconsInRegion:(CLBeaconRegion *)region ;
- (void)stopRangingBeaconsInRegion:(CLBeaconRegion *)region ;


- (void)allowDeferredLocationUpdatesUntilTraveled:(CLLocationDistance)distance
                      timeout:(NSTimeInterval)timeout;

- (void)disallowDeferredLocationUpdates;

+ (BOOL)deferredLocationUpdatesAvailable;

@end

上面的没有就讲解的,可以在使用到地里栅栏的时候再写了。


CLLocationManager的相关属性讲解

标签:ios   cllocation   cllocationmanager   定位管理器   苹果官方   

原文地址:http://blog.csdn.net/u012496940/article/details/47664783

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!