[英]How to get current location using internet in xcode?
如何使用互联网获取当前位置?
我在需要用户纬度和经度的地方制作应用程序。
谁能告诉我是否从设置中关闭了iPhone定位服务,
我想从互联网而不是从GPS获取当前位置,那我怎么能得到它
在iOS中?
在最新的iOS中这可能吗?
我使用了Core Location framework
。
如果有任何想法,请与我分享。
就像在Android
一样,他们使用类似的东西
isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
所以如果定位服务OFF
,我也想获取位置。
提前致谢。
没有任何Apple SDK,但您使用的是HTML5。 从您的本机代码调用此html并获取响应以进行处理
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to get your coordinates:</p>
<button onclick="getLocation()">Try It</button>
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
x.innerHTML="Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.