Answer the question
In order to leave comments, you need to log in
How to test geolocation?
Made a location function.
However, the program crashes when geolocation is turned off.
What eksepsheny prescribe usually?
I tried to write something with myths
CLLocationManager.locationServicesEnabled() == true)
@IBAction func CurrentLocation(sender: AnyObject) {
if (CLLocationManager.locationServicesEnabled() == true) {
let userLocation = locationmanager.location
let center = CLLocationCoordinate2D(latitude: userLocation!.coordinate.latitude, longitude: userLocation!.coordinate.longitude)
var currentAnnotation = MKPointAnnotation()
currentAnnotation.coordinate = center
currentAnnotation.title = "You're here!"
MapApple.addAnnotation(currentAnnotation)
print("location is enabled")
}
else {
print("location is diable")
let AlertButton = UIAlertController(title: "Geo", message: "You need to switch it on", preferredStyle: .Alert)
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question