//// locationViewController.m// baiDuDemo//// Created by City--Online on 15/6/4.// Copyright (c) 2015年 XQB. All rights reserved.//#import "locationViewController.h"#import "BMKLocationService.h"#import "BMKMapView.h"@interface locationViewController ()@property(nonatomic,strong) BMKLocationService *locService;@end@implementation locationViewController- (void)viewDidLoad { [super viewDidLoad]; //设置定位精确度,默认:kCLLocationAccuracyBest [BMKLocationService setLocationDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; //指定最小距离更新(米),默认:kCLDistanceFilterNone [BMKLocationService setLocationDistanceFilter:100.f]; //初始化BMKLocationService _locService = [[BMKLocationService alloc]init]; _locService.delegate = self; //启动LocationService [_locService startUserLocationService];}/** *在将要启动定位时,会调用此函数 */- (void)willStartLocatingUser{ NSLog(@"willStartLocatingUser");}/** *在停止定位后,会调用此函数 */- (void)didStopLocatingUser{ NSLog(@"在停止定位后");}/** *用户方向更新后,会调用此函数 *@param userLocation 新的用户位置 */- (void)didUpdateUserHeading:(BMKUserLocation *)userLocation{ NSLog(@"用户方向更新后");}/** *用户位置更新后,会调用此函数 *@param userLocation 新的用户位置 */- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation{ [_locService stopUserLocationService]; NSLog(@"%@",userLocation.location.description);}/** *定位失败后,会调用此函数 *@param error 错误号 */- (void)didFailToLocateUserWithError:(NSError *)error{ NSLog(@"定位失败后");}- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}@end