swift thread 1: exc_bad_instruction(code=exc_i386_invop,subcode=0x0) error

672 Views Asked by At

Here is my code:

import UIKit
import MapKit
class ViewController: UIViewController , MKMapViewDelegate{

    @IBOutlet weak var map: MKMapView!


    override func viewDidLoad() {
        super.viewDidLoad()
        let initialLocation = CLLocation(latitude: 21.282778, longitude: -157.829444)
        centerMapOnLocation(initialLocation)

        }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    let regionRadius: CLLocationDistance = 1000
    func centerMapOnLocation(location: CLLocation) {
        let coordinateRegion = MKCoordinateRegionMakeWithDistance(location.coordinate,
            regionRadius * 2.0, regionRadius * 2.0)
        map.setRegion(coordinateRegion, animated: true)
    }

I am getting error " swift thread 1: exc_bad_instruction(code=exc_i386_invop,subcode=0x0) error " at the map.setRegion() location

0

There are 0 best solutions below