let location = CLLocationCoordinate2D(latitude: (marker.userData as! location).lat, longitude: (marker.userData as! location).lon)
userData
属于id类型,它被强制转发为location
但是当我尝试在Objective-C中强制转换userData
时,我得到了这个:
找到名为'location'的多个方法,结果不匹配, 参数类型或属性
这是我的代码:
struct CLLocationCoordinate2D markerLocation;
markerLocation.longitude=[(CLLocation *)[marker.userData location] coordinate].longitude;
答案 0 :(得分:2)
您想要投射ec2
,而不是userData
消息的结果。
location
......应该......
markerLocation.longitude=[(CLLocation *)[marker.userData location] coordinate].longitude;