无法在 iPhone 中使用经纬度获取地址

发布于 2024-08-10 13:34:29 字数 89 浏览 5 评论 0原文

请任何人帮我获取用户的纬度/经度位置。我尝试了很多方法,但无法解决这个问题。如果有人有想法请帮助我。

我是 iPhone 的初学者,所以请简要说明。

Please can any one help me get the latitude/longitude location of the user. I have tried many things but I'm not able to solve this problem. If anyone has an idea please help me.

I'm a beginner in iPhone so please give brief explanation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世态炎凉 2024-08-17 13:34:29

我假设你的意思是在浏览器(不是本机应用程序)中,因为你已将此问题标记为 javascript。您可以通过异步回调来完成此操作:

//Function that does something once the device has a location
//May be called repeatedly
function handler(location) {
  var longitude = location.coords.longitude;
  var latitude = location.coords.latitude;
  var accuracy = location.coords.accuracy

  //Do something with them
}

//Register the handler and tell the phone to start finding a location
navigator.geolocation.getCurrentPosition(handler);

它是 HTML5 地理定位内容的一部分,有一个草案 此处

I assume you mean in the browser (not a native application), since you have tagged this question as javascript. You do it via an asynchronous callback:

//Function that does something once the device has a location
//May be called repeatedly
function handler(location) {
  var longitude = location.coords.longitude;
  var latitude = location.coords.latitude;
  var accuracy = location.coords.accuracy

  //Do something with them
}

//Register the handler and tell the phone to start finding a location
navigator.geolocation.getCurrentPosition(handler);

It is all part of the HTML5 geolocation stuff, there is a draft here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文