Hello I was trying to load a map for my application of IOs with a certain location and the appropriate zoom was following a tutorial but in my house there is an error, I attached the image of the error that appears in addition to the map code. in this case I am using Xcode 7 and Swift 2.
fatal error: unexpectedly found nil while unwrapping an Optional value
import UIKit
import MapKit
class ViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
maptal()
}
func maptal()
{
let tallat:CLLocationDegrees = 27.175015
let tallon:CLLocationDegrees = 78.042139
let tajcordinate = CLLocationCoordinate2D(latitude: tallat, longitude: tallon )
let latdelta:CLLocationDegrees = 0.01
let longdelta:CLLocationDegrees = 0.01
let tajspan = MKCoordinateSpan(latitudeDelta: latdelta, longitudeDelta: longdelta)
let tajregion = MKCoordinateRegion(center: tajcordinate, span: tajspan)
mapView.setRegion(tajregion, animated: true)
let tajanotation = MKPointAnnotation()
tajanotation.title = "taj mahal"
tajanotation.subtitle = "holita"
tajanotation.coordinate = tajcordinate
mapView.addAnnotation(tajanotation)
}
}