简体   繁体   English

ios位置跟踪器问题(目标-c)

[英]ios location tracker problems(objective-c)

I am developing FitnessApp using objective-C. 我正在使用Objective-C开发FitnessApp。 This app has a function to track location of walking user and draw path of user. 该应用程序具有跟踪步行用户的位置并绘制用户路径的功能。 I used CLocationManager and get user location in it's delegate. 我使用了CLocationManager并在它的委托中获取用户位置。 Here is my code. 这是我的代码。

myLocation.desiredAccuracy = kCLLocationAccuracyBest ;
myLocation.distanceFilter = 12 ;
myLocation.activityType = CLActivityTypeAutomotiveNavigation;
myLocation.delegate = self;
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *newLocation = locations.lastObject;
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = newLocation.coordinate;
marker.map = mapView;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithTarget:newLocation.coordinate zoom:ZOOM];
[mapView animateToCameraPosition:camera];
}

but result is very wrong, it is very shaking and ZIGZAG even I am running along street. 但是结果很不对劲,即使我在街上奔跑,也非常震撼,ZIGZAG。 Btw, I compared it with Google Map Navigation and it is correct, What I am wrong ? 顺便说一句,我将其与Google Map Navigation进行了比较,这是正确的,我错了吗? How should I do to develop GPS tracking module like Uber, Google map without shaking? 如何开发Uber,Google地图等GPS跟踪模块而又不会动摇?

Plz help me. 请帮我。

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
    [self.locationManager requestWhenInUseAuthorization];

    [self.locationManager startUpdatingLocation];
    self.locationManager.pausesLocationUpdatesAutomatically = NO;

    [self updateMapWithCoordinates:self.userLocationcoordinates];
}

First ask the system if it provide location, then cal startupdatinglocation, and set it Stop to Know, Now everytime on location update , yougot your location .. 首先询问系统是否提供位置,然后再校准启动日期位置,并将其设置为“停止知道”,现在每次位置更新时,您都会忘记位置..

You have to develop with core motion. 您必须以核心动力发展。 Generally above method has long delay and wrong location. 通常,以上方法具有较长的延迟和错误的位置。

when you stay one position, then you will get several location exactly. 当您停留在一个位置时,您将确切地获得多个位置。

So that you have to use the core motion. 这样就必须使用核心运动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM