var mapViewDelegate: AnyObject?
init(mapView: AGSMapView, mapViewDelegate: AnyObject) {
self.mapView = mapView
self.mapViewDelegate = mapViewDelegate
super.init()
}
mapView?.touchDelegate = mapViewDelegate
mapView?.layerDelegate = mapViewDelegate
then:
Cannot assign value of type 'AnyObject?' to type 'AGSMapViewTouchDelegate!'
What can I do?And thank you for all the answer
var mapViewDelegate: AnyObject?
It should not be like this.
It should be of belonging type of the Protocol. Not Anyobject.
Like i have a protocol named AllowNotificationDelegate. So my delegated variable is defined as
weak var allowNotificationDelegate: AllowNotificationDelegate?
type of AllowNotificationDelegate.
so you should write
weak var mapViewDelegate: AGSMapViewTouchDelegate?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.