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); }
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); }
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在室内,iPhone 使用手机信号塔或 WIFI 位置。这些位置不会返回高度。您必须在室外进行测试才能获得 GPS。
为确保您使用的是 GPS,请同时检查水平精度。如果在 2 位数字范围内,则您应该使用 GPS,并且很可能会获得海拔高度读数
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