Questions tagged [mapkit]

MapKit is Apple's framework for presenting and annotating scrollable and zoom-enabled maps on iOS, IPadOS, tvOS, watchOS, and macOS.

MapKit is Apple's framework for presenting and annotating maps for iOS, IPadOS, tvOS, watchOS, and macOS. Maps are rendered via the MKMapView control, which offers scrolling, zooming, and optionally real-time highlighting of the user's current location on both traditional maps as well as satellite imagery.

Maps can be further customized by:

  • Adding annotations (information about a point on the map), which can then be represented on the MKMapView using annotation views, graphical representations (such as a drop pin or a custom image). Annotations also may have associated attributes (such as text that can appear in a callout box that appears when you tap on an annotation view), and these callout boxes can also have additional behaviors (e.g. left and right accessory controls that you can use to perform custom operations, etc);

  • Adding overlays, graphical representations between a collection of map points (e.g. a MKPolyline that represents one or more line segments, such as a path, along the map; a MKPolygon that represents a shaded portion of the map defined by the coordinates of a polygon, a MKCircle that represents a shaded circle around a particular map point, etc.). Overlays are represented by MKOverlayView objects which define the particulars of how the overlay is represented (line thickness, line color, shading, etc.).

  • The Map Kit framework also provides local search capabilities (as of iOS 6.1, OS X 10.9), via MKLocalSearch, which will asynchronously return establishments and points of interest based upon the search criteria.

The reverse geocoding, via MKReverseGeocoder, is deprecated as of iOS 5.0, superseded by the CLGeocoder class of the Core Location framework

MapKit is part of the following SDKs:

  • iOS 3.0 and later,
  • macOS 10.9 and later,
  • Mac Catalyst 13.0 and later,
  • tvOS 9.2 and later,
  • watchOS 2.0 and later.

###Related tags:

###References:

5877 questions
2
votes
1 answer

Using Annotations In Swift - .addAnnotation() Not Working

I am using the MapKit and I am receiving the following error: The locations.count? is not working even when I am putting that in as the argument. It says that it doesn't allow Int as a parameter. I'm not too sure why this isn't working. import…
Divine Davis
  • 532
  • 1
  • 6
  • 15
2
votes
1 answer

MKPinAnnotationView no longer using images in ios9

Since the iOS9 upgrade, the custom images on my MKPinAnnotationView are no longer showing up. Is there a documented change somewhere?
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460
2
votes
1 answer

MKMapView Draw connected lines between all points

I have a list of 50+ coordinates. What is the most efficient way to draw lines between all these coordinates (should create a "circular" path because they all have a display order) that is also easy to customize (line thickness, color,…
Mario A Guzman
  • 3,483
  • 4
  • 27
  • 36
2
votes
2 answers

Casting MKOverlay to MKPolyline return null

I use the following delegate method to draw route on Map. It works fine most of the time except in one route that has large coordinates array. Sometimes it can cast the MKOverlay to MKPolyline and sometimes it cannot for the same route. Any idea…
Sarah
  • 1,595
  • 3
  • 25
  • 34
2
votes
0 answers

Mapkit, Making web service call in mapView(_:regionDidChangeAnimated:), but this function will be called several times at the beginning

I need to keep tracking user's current visible region in map view, based on user's current visible region, I will make a async web service call. So I make the async web service call in the mapView(_:regionDidChangeAnimated:) function. However this…
PoppinDouble
  • 315
  • 2
  • 12
2
votes
2 answers

MKAnnotationView update title and subtitle with distance when event is received

I'm developing an iphone app using mapkit and CLLocationManager. I put lots of MKPinAnnotationView on map (about 100) and I want to update all callout's subtitle whith user distance when I receive it. How to do it ? Thanks I try this to update…
Dragouf
  • 4,676
  • 4
  • 48
  • 55
2
votes
1 answer

swift: display mkdirection instructions in real time

Using mapKit, I would like to guide the user on the road by displaying the instruction for the current step. Hence, once the step is completed, the instruction is updated for the corresponding (next) step. From what I know, mapKit doesn't allow you…
Quentin Malgaud
  • 405
  • 6
  • 21
2
votes
1 answer

how to create a custom class that conforms to protocol

I have a map that is displaying all restaurant objects. I'm trying to pass the restaurant object to the map annotation so that i can display a detail view with all the restaurant info. After researching, I'm trying to create a class that conforms…
Gama
  • 352
  • 2
  • 16
2
votes
1 answer

Detect when mapItemForCurrentLocation fails to locate your device

I can't figure out how to test for a lack of success when getting the map's current location. let source = MKMapItem.mapItemForCurrentLocation() // returns an object with: // isCurrentLocation = 1 // name="Unknown location" I could test…
SimplGy
  • 20,079
  • 15
  • 107
  • 144
2
votes
2 answers

Calculate compass heading to a CLLocation - Haversine functions for iOS

I understand how to get the distance between 2 CLLocations. I need to determine the generalized compass bearing (N, NE, E etc.) from a CLLocation to another CLLocation. Before I implement something to derive the bearing with the haversine formula is…
Nick
  • 8,483
  • 10
  • 46
  • 65
2
votes
1 answer

Google Maps coordinates different than apple maps

I am converting an Android app which uses Google Maps and the given longitude and latitude. I want to port the app to iOS and was thinking which maps system was better, either the native from Apple or the Google SDK. Apart from that I have some POI…
Rene Gens
  • 480
  • 6
  • 18
2
votes
1 answer

MapKit camera on xcode using swift?

I got the following code from Tilt map in Mapkit programmatically using Swift but I'm not sure what to do with it. I want my map to be in like a 45 degree angle, kind of like when you use the maps app and you drag up using 2 fingers, I want my…
Amissi
  • 167
  • 2
  • 12
2
votes
1 answer

MapKit: Check if a user is at an address. (In a Building)

Is there anyway, using MapKit, to check if a user is in a building, at a certain address? I have the users current position (longitude, latitude): I have a buildings address - for example, 298 Texas St, San Francisco. Is there anyway I could tell if…
dannybess
  • 599
  • 4
  • 18
2
votes
0 answers

Map kit Custom PopupView instead of callout Bubble view IOS Swift

I want to show some details, contain an image and related details when i click on the pin . i don't know how to customise bubble view.Can any one help me to find out a solution for this will be helpful. Code below i tried but height is fixed not…
2
votes
1 answer

How to access specific index of MKAnnotation

I have a mapView populated with markers using MKAnnotations. I am able to get the array of annotations fine. However, how do I figure out the index of the marker that is tapped? Say I tapped a marker and the MKAnnotation popped up. How do I get…
Josh O'Connor
  • 4,694
  • 7
  • 54
  • 98