I'm writing an Application that makes use of MapKit. I have implemented MKLocalSearch and I get back an array of MKMapItem's. However I was wondering if it was possible to get the category of each of these items.For example in the Maps application there is different icons displayed for shops, hotels, train stations and so on. Also if you view a place mark.You get a category label such as Grocery. As a developer can I access that information for a Map Item? If so I would like to know how.
Thank You
Yes you can get this information. See below method for information details from search location.
I fear that you can only get address details from
MKPlacemark
.What now you have to do is, get address details from
MKPlacemark
and you need to take a help of any open source API that can help you to categories addresses into some labels/annotation.One of the good API is Mapbox, but unfortunately it is paid.
So from third party API you can do magical search. I haven't search for kind of API / WebService but it should be there.
Objective C Code:
Swift Code: