userLocation: latitude/longitude return zero?

前端 未结 2 1591
执笔经年
执笔经年 2021-01-28 18:23

I am just looking at mapKit and decided to make a quick button to display my current location, however when I press the button my latitude/longitude always display as [0.000000]

相关标签:
2条回答
  • 2021-01-28 18:56
    [...] as I can see the map on the simulator [...]

    Test it on the device. By default, on the simulator, the coordinates you get back are Apple's headquarters. Cf. doc.

    See this other SO question for workarounds and useful utilities : Testing CoreLocation on iPhone Simulator

    0 讨论(0)
  • 2021-01-28 19:07

    Either the userLocation is not visible on the map (see the userLocationVisible property) or there is some problem setting up the myMapView property and it's nil (i.e. not connected in interface builder)

    0 讨论(0)
提交回复
热议问题