I've got an issue to get an altitude for specific location pointed on the Apple Map. To obtain the altitude I use the following code:
我有个问题,要得到苹果地图上特定位置的高度。为了获得高度,我使用以下代码:
self.touchPointLocation = CLLocation(latitude: newCoordinate.latitude, longitude: newCoordinate.longitude)
let altutide: CLLocationDistance = self.touchPointLocation.altitude
Every time I run the application on the device I get altitude for pointed location 0.0.
每次我在设备上运行应用程序时,我都会得到指向位置0.0的高度。
Does anybody know how to get around this problem?
有人知道怎么解决这个问题吗?
1 个解决方案
#1
1
I am pretty sure if you are indoors you cannot get altitude readings(indoors device uses cell tower/WIFI location). Try testing your code on a real device outdoors. You need the GPS reading to get an altitude reading.
我很确定,如果你在室内,你无法获得高度读数(室内设备使用基站/WIFI位置)。试着在室外的真实设备上测试你的代码。你需要GPS读数才能得到高度读数。
I had a similar problem with my code, drove me nuts(2-3 hours). Then I was outside for a fag, tried again on real device. Poof, it worked.
我的代码也有类似的问题,让我抓狂(2-3小时)。然后,我在外面做了个鬼脸,又试了一次真正的设备。噗,它工作。
#1
1
I am pretty sure if you are indoors you cannot get altitude readings(indoors device uses cell tower/WIFI location). Try testing your code on a real device outdoors. You need the GPS reading to get an altitude reading.
我很确定,如果你在室内,你无法获得高度读数(室内设备使用基站/WIFI位置)。试着在室外的真实设备上测试你的代码。你需要GPS读数才能得到高度读数。
I had a similar problem with my code, drove me nuts(2-3 hours). Then I was outside for a fag, tried again on real device. Poof, it worked.
我的代码也有类似的问题,让我抓狂(2-3小时)。然后,我在外面做了个鬼脸,又试了一次真正的设备。噗,它工作。