I've been trying to add a MapKit to my app where you can see a location on the map. I'm not trying to do anything special. I just wanted the map to automatically show you where I want it to be. I've added the following code below, but every time that I run the app it will crash and give me the error Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0X0) on line 10. I've tried everything and nothing seems to be working. What can I do?
import MapKit
class ViewController: UIViewController, MKMapViewDelegate {
@IBOutlet weak var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
mapView.delegate = self
let mexico = MKCoordinateRegionMake(CLLocationCoordinate2DMake(20.648097, -105.235168), MKCoordinateSpanMake(0.01, 0.01))
mapView.setRegion(mexico, animated: true)
}
If it helps, I'm running the latest version of Swift and Xcode.