0

I am trying to add map annotation, but when i try to run the app, the map annotation doesnt show, and give error message.

Add Map Annotation[3668:68848] Could not inset legal attribution from corner 4

actually I just follow along a tutorial on Youtube in here https://www.youtube.com/watch?v=hRextIKJCnI , in swift3 this code seems work, but I don't know why it doesnt work in me. I am using swift 4 and Xcode 9.2

I have tried a solution from stack overflow but it doesn't work in me, in here Could not inset legal attribution from corner 4 swift

What went wrong in here?

import UIKit
import MapKit

class ViewController: UIViewController {


    @IBOutlet weak var mapKitView: MKMapView!



    override func viewDidLoad() {
        super.viewDidLoad()

        let span : MKCoordinateSpan = MKCoordinateSpanMake(0.001, 0.001)
        let location : CLLocationCoordinate2D = CLLocationCoordinate2DMake(-6.239116, 106.789415)
        let region : MKCoordinateRegion = MKCoordinateRegionMake(location, span)
        mapKitView.setRegion(region, animated: true)

        let annotation =  MKPointAnnotation()
        annotation.title = "My Shop"
        annotation.subtitle = "Come visit here"
        mapKitView.addAnnotation(annotation)

    }




}
Shivam Tripathi
  • 1,405
  • 3
  • 19
  • 37
Alexa289
  • 8,089
  • 10
  • 74
  • 178

1 Answers1

1

You are saying:

    let annotation =  MKPointAnnotation()
    annotation.title = "My Shop"
    annotation.subtitle = "Come visit here"
    mapKitView.addAnnotation(annotation)

And that's all you're saying. But... That annotation has no coordinate! So how do you imagine the map can possibly know where it's supposed to go?

matt
  • 515,959
  • 87
  • 875
  • 1,141