如何添加多个注释?

How to add several annotations?

我想在地图视图中显示多个图钉。所以我这样做:

let smth = [Smth(title: "Title 1", 
        locationName: "Street 1", 
        coordinate: CLLocationCoordinate2D(latitude: 43.2345965, longitude: 76.8907758)),
    Smth(title: "Title 2", 
        locationName: "Street 2",
        coordinate: CLLocationCoordinate2D(latitude: 43.2059723, longitude: 76.9012738))]

然后:

mapView.addAnnotation(smth)

但它显示此错误:

        Argument type '[Smth]' does not conform to expected type 'MKAnnotation'.

我该怎么办? 谢谢

解决了这个问题:

mapView.addAnnotations(smth)

数组需要方法 "addAnnotations",而不是 "addAnnotation".