swift - Error: Could not cast value of type NSKVONotifying_MKUserLocation to Park_View.AttractionAnnotation -


when using func:

func mapview(mapview: mkmapview!, viewforannotation annotation: mkannotation!) -> mkannotationview! {     let annotationview = attractionannotationview(annotation: annotation, reuseidentifier: "attraction")     annotationview.canshowcallout = true     return annotationview } 

this error occured:

could not cast value of type 'nskvonotifying_mkuserlocation' (0x7e8a62b0) 'park_view.attractionannotation' (0xf7948).

it working when try add corelocation find user location code start having error.

i found out mkuserlocation annotation too.

here solution came out , solve error.

func mapview(mapview: mkmapview!, viewforannotation annotation: mkannotation!) -> mkannotationview! {     if (annotation mkuserlocation) {         return nil     }     else {         let annotationview = attractionannotationview(annotation: annotation, reuseidentifier: "attraction")         annotationview.canshowcallout = true         return annotationview     } } 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -