I like to know if it is possible to find the Latitude and the Longitude on iPhone that is not connected to WIFI and using cellular data while inside a building with Swift?
IF not what is the alternative way of determine that?
I like to know if it is possible to find the Latitude and the Longitude on iPhone that is not connected to WIFI and using cellular data while inside a building with Swift?
IF not what is the alternative way of determine that?
For iOS 8 and swift2.3 add your project's info.plist privacy for always location use and then use this code
let locationManager = CLLocationManager()
var userLatitude:CLLocationDegrees! = 0
var userLongitude:CLLocationDegrees! = 0
use this code in viewDidLoad -
self.locationManager.requestAlwaysAuthorization()
self.locationManager.requestWhenInUseAuthorization()
if CLLocationManager.locationServicesEnabled()
{
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
locationManager.startMonitoringSignificantLocationChanges()
userLatitude = locationManager.location?.coordinate.latitude
userLongitude = locationManager.location?.coordinate.longitude
}