高度问题IOS [英] Altitude problem IOS

查看:161
本文介绍了高度问题IOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在获得高度时遇到问题,它返回0.0000。这是我的代码:

   - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation :( CLLocation *)oldLocation {
NSString * tAltitude = [NSString stringWithFormat:@%f,[newLocation altitude]];
CLLocationCoordinate2D coord = newLocation.coordinate;
MKCoordinateSpan span = {.latitudeDelta = 0.005,.longitudeDelta = 0.005};
MKCoordinateRegion region = {coord,span};
[map setRegion:region];
NSLog(@Location:%@,[newLocation description]);
NSLog(@altitudine:%@,tAltitude);如果你在室内,iPhone使用手机信号塔,如果你在室内,或WIFI位置。这些位置不会返回高度。你必须测试室外以获得GPS。

为确保您使用的是GPS,请检查水平精度。如果它在2位数的范围内,则应该使用GPS,并且很可能您将读取高度

I have a problem in getting the altitude , it returns 0.0000 . Here is my code:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSString *tAltitude  = [NSString stringWithFormat:@"%f", [newLocation altitude]];
CLLocationCoordinate2D coord=newLocation.coordinate;
MKCoordinateSpan span = {.latitudeDelta =  0.005, .longitudeDelta =  0.005};
MKCoordinateRegion region = {coord, span};
[map setRegion:region];
NSLog(@"Location: %@", [newLocation description]);
NSLog(@"altitudine:%@",tAltitude); }

解决方案

If you are indoor, iPhone uses cell tower, or WIFI location. These location will not return altitude. You have to test outdoor to get GPS.

To make sure that you are using GPS, check the horizontal accuracy as well. If it is in the range of 2 digits, you should be on GPS, and most likely you will get altitude reading

这篇关于高度问题IOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆