简体   繁体   中英

How to get current location using internet in xcode?

how to get current location using internet ?

i'm making an application where i necessary need the latitude and longitude of user.

Would anyone please tell me if i off the iPhone location service from settings and

i want to get current location from internet not from the GPS then how can i get it

in iOS?

is this possible in latest iOS ?

I used the Core Location framework .

If any one having any idea please share with me.

Like in Android they use something like this

isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);

isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

so i also want to get location if the location service is OFF .

Thanks in advance.

there no any apple sdk but you use HTML5. call this html from your native code and get response to handle

<!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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM