MKMap class encapsulates information about a specific point on a map. This information includes the map location and any other data that might be relevant, such as the name of a business at that location. Apps use this class to share map-related data with the Maps app.
- iOS 6.0+
- macOS 10.9+
- tvOS 9.2+
- watchOS 2.0+
You use this class in one of two ways. If your app is able to display point-to-point directions, the Maps app can send a directions request to your app in response to a request by the user to use your app for routing. In that case, the directions request contains map items with the start and end points to use when creating the directions. The second way to use map items is to create them in your app and then ask the Maps app to display them. For example, if your app allows the user to search for local businesses or points of interest, you can create a map item for each location and ask Maps to display pins at the corresponding locations.
Usually, you use this class to represent fixed locations on the map, but you can also use the
for method to get a map item that represents the user’s current location. For privacy reasons, and because the user’s location can change, the map item returned by that method does not contain any coordinate data. When you need the actual location of the user, you must use the Core Location framework to retrieve it.