Xcode version: 8.1
aim:
To replace native infoWindow by custom one
problem:
myView.delegate = self
(See my code & my research #21)what I have done:
Inserted mapView function into ViewController.swift:
override func viewDidLoad() {
super.viewDidLoad()
...
let camera = GMSCameraPosition.camera(withLatitude: latitude,
longitude: Longitude, zoom: 16)
let mapView = GMSMapView.map(withFrame: CGRect.zero, camera: camera)
mapView.delegate = self // Thread 1:signal SIGABRT shown if i add this line
mapView.isMyLocationEnabled = true
self.view = mapView
let marker = GMSMarker()
marker.position = CLLocationCoordinate2DMake(latitude, Longitude)
marker.title = "Me"
marker.map = mapView
mapView.selectedMarker = marker
}
func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
let infoWindow = Bundle.main.loadNibNamed("CustomInfoWindow", owner: self.view, options: nil)!.first! as! CustomInfoWindow
infoWindow.title.text = marker.title
return infoWindow
}
my research:
Did you implement GMSMapViewDelegate?
ViewController: GMSMapViewDelegate {
...
}
It seems to be that you are getting the error(crash) because you are setting the delegate to self, but your controller does not conform to that protocol.