The location point on the map in the simulator is not loaded, just the map is visible, although everything seems to be fully spelled out. Let it be for now:


enter image description here

It should be like this:

enter image description here

Here is the file code. It seems that everything that was needed was spelled out:

import UIKit import MapKit import CoreLocation class MapVC: UIViewController { @IBOutlet weak var mapView: MKMapView! var locationManager = CLLocationManager() let authorizationStatus = CLLocationManager.authorizationStatus() let regionRadius: Double = 1000 override func viewDidLoad() { super.viewDidLoad() mapView.delegate = self locationManager.delegate = self configureLocationServices() } @IBAction func centerMapBtnWasPressed(_ sender: Any) { if authorizationStatus == .authorizedAlways || authorizationStatus == .authorizedWhenInUse{ centerMapOnUserLocation() } } } extension MapVC: MKMapViewDelegate { func centerMapOnUserLocation() { guard let coordinate = locationManager.location?.coordinate else { return } let coordinateRegion = MKCoordinateRegionMakeWithDistance(coordinate, regionRadius * 2.0, regionRadius * 2.0) mapView.setRegion(coordinateRegion, animated: true) } } extension MapVC: CLLocationManagerDelegate { func configureLocationServices(){ if authorizationStatus == .notDetermined{ locationManager.requestAlwaysAuthorization() } else { return } } func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { centerMapOnUserLocation() } } 

Here is an image (to enlarge, just click on it) of the plist file changed during the work. Added last three lines. The latter is different from the one that was in the video tutorial. Wednesday insistently suggested to register as in the end it was prescribed - "Privacy - Location", in the video tutorial, the last line had a slightly different appearance, namely, "NSLocationAlwaysAndWhenInUseUsageDescription". I do not know whether this has any meaning, I cite it, just in case:

enter image description here

    1 answer 1

    When you launched the project, and you opened the Simulator on the top, tap on Debug

    enter image description here

    Then tap on Location - custom location

    should look like this:

    enter image description here

    Instead of my values, substitute your values. Or leave the latitude and longitude by default. Apparently you have none

    • Thanks I got it! - Aresandro
    • @Aresandro, Always please, if the answer came up, then please tick. - Kerim Khasbulatov