我正在尝试添加 map 注释,但是当我尝试运行应用程序时, map 注释不显示,并给出错误消息。
Add Map Annotation[3668:68848] Could not inset legal attribution from corner 4
实际上我只是跟着 Youtube 上的教程在这里 https://www.youtube.com/watch?v=hRextIKJCnI ,在 swift3 中,这段代码似乎有效,但我不知道为什么它对我不起作用。我正在使用 swift 4 和 Xcode 9.2
我已经尝试过堆栈溢出的解决方案,但它对我不起作用,在这里 Could not inset legal attribution from corner 4 swift
这里出了什么问题?
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)
}
}
最佳答案
你是说:
let annotation = MKPointAnnotation()
annotation.title = "My Shop"
annotation.subtitle = "Come visit here"
mapKitView.addAnnotation(annotation)
这就是您所说的全部。但是……那个注解没有坐标
!那么你怎么想象 map 可能知道它应该去哪里?
关于ios - 无法在 Swift 中显示 map 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48655185/