At the moment the map kit APls only support non-volumetric maps (i.e. in a window or in a volume, but on a 2D surface).
Is support for 3D volumetric maps in VisionOS in the works? And if so when can we expect it to be available?
MapKit
RSS for tagDisplay map or satellite imagery from your app's interface, call out points of interest, and determine placemark information for map coordinates using MapKit.
Posts under MapKit tag
90 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
I'm using MapKit's MKDirections.calculate, calculateETA, and reverse geocoding (via CLGeocoder.reverseGeocodeLocation) in my iOS app.
I understand that there are undocumented rate limits for these services to prevent abuse, but I couldn't find official details.
I would like to know:
Are the rate limits applied per device, per app installation, or are they shared across all users of the same app bundle ID?
Is there any guidance on how to design these features to avoid hitting rate limits in a production environment?
What is the best practice if a user repeatedly triggers routing or reverse geocoding (e.g., typing or moving the map)?
Any clarification or official documentation would be greatly appreciated. Thank you!
Hello Team,
We have Advanced App Clip Experiences live but we have add App Clip experience URL since long ago but status remains as Received and never changed to Published, can you please help us to fix this issue.
Please see attached.
Thanks
Hi there,
I’m developing a watchOS app using SwiftUI, and I want to allow users to interact with the map using the panning gesture and also drop waypoints by long pressing anywhere on the map—just like in the built-in Apple Maps app on watchOS, where a long press drops a pin and panning still works seamlessly.
However, with SwiftUI’s Map, any attempt to attach a gesture other than .onTapGesture (such as LongPressGesture or DragGesture) seems to block the built-in map interactions, making panning impossible.
Is there a supported approach to detect long press gestures anywhere on the map while still allowing all standard map interactions (as seen in Apple Maps on watchOS)? Or is this something only possible with private APIs or internal access?
Any guidance or best practices would be greatly appreciated!
Thank you!
Hello I'm currently building a feature within an ios app using SwiftUI and Mapkit to record the gps cordinates of a user as they move and render the track on the map. the idea is not really to have a "track" but to have a visual representation of the area the user sees while they are moving around. I need this width/breadth to be relative to the map and not the screen, such that when I zoom in and out of the map, the size will adjust automatically.
I am currently encountering two deprecated errors in my code. Could someone please identify the issues with the code?
Errors:
'init(coordinateRegion:interactionModes:showsUserLocation:userTrackingMode:annotationItems:annotationContent:)' was deprecated in iOS 17.0: Use Map initializers that take a MapContentBuilder instead.
'MapAnnotation' was deprecated in iOS 17.0: Use Annotation along with Map initializers that take a MapContentBuilder instead.
Code:
// MARK: - Stores Map (Dynamic)
struct StoresMapView: View {
@State private var storeLocations: [StoreLocation] = []
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: -31.95, longitude: 115.86),
span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5)
)
var body: some View {
Map(coordinateRegion: $region, interactionModes: .all, annotationItems: storeLocations) { store in
MapAnnotation(coordinate: CLLocationCoordinate2D(latitude: store.latitude, longitude: store.longitude)) {
VStack(spacing: 4) {
Image(systemName: "leaf.circle.fill")
.font(.title)
.foregroundColor(.green)
Text(store.name)
.font(.caption)
.fixedSize()
}
}
}
.onAppear(perform: loadStoreData)
.navigationTitle("Store Locator")
}
private func loadStoreData() {
guard let url = URL(string: "https://example.com/cop092/StoreLocations.json") else { return }
URLSession.shared.dataTask(with: url) { data, _, _ in
if let data = data, let decoded = try? JSONDecoder().decode([StoreLocation].self, from: data) {
DispatchQueue.main.async {
self.storeLocations = decoded
if let first = decoded.first {
self.region.center = CLLocationCoordinate2D(latitude: first.latitude, longitude: first.longitude)
}
}
}
}.resume()
}
}
Hello,
I have used CPPointOfInterestTemplate for displaying data and as user scrolls using the up/down arrow, I do not see any change in the map. Is there a way to highlight the POIs as the user scrolls through the list?
I need to use the map controls and zoom to check the markers on the map. Is it possible to set the zoom level of the map in CarPlay?
Pls suggest on the above queries
Summary:
Hi! I'm experiencing an issue between what Apple Maps displays in the UI and what is accessible via MapKit APIs such as MKLocalSearch and CLGeocoder. Specifically, some verified and publicly visible businesses (with proper POI categories like .cafe) are not returned by coordinate-based POI searches or reverse geocoding, even when their exact address and coordinates are known.
Repro Steps:
In Apple Maps (iOS), search for Rustic Knead located at:
1130 State St, Lemont, IL 60439
Note that:
The business appears visually on the map
It is categorized as a cafe
The address is 1130 State St
Now in code, attempt both:
A coordinate-based POI search using MKLocalSearch.Request(region:)
A reverse geocoding lookup via CLGeocoder.reverseGeocodeLocation
Example coordinates:
latitude: 41.673604, longitude: -88.002295
Expected Behavior:
Given the precise coordinates and Apple Maps showing the POI publicly, I expect either or both of the following:
MKLocalSearch should return the POI (Rustic Knead) within a reasonable radius and appropriate .pointOfInterestFilter.
CLGeocoder should return a CLPlacemark with either name = "Rustic Knead" or an areasOfInterest value containing it.
Actual Behavior:
MKLocalSearch returns 0 POIs at that location, even with filters removed and radius increased to 500+ meters.
CLGeocoder.reverseGeocodeLocation returns a valid postal address but does not include the business name in .name or areasOfInterest.
Searching by business name (e.g., "Rustic Knead") does work, but coordinate/address-only lookups do not.
Questions:
Are there known limitations in how MapKit surfaces POIs by coordinate or reverse geocode?
Is there a way to ensure public, categorized POIs are accessible programmatically via MapKit APIs?
Is there a better strategy to provide coordinates and return a business name?
Trying to incorporate a LookAroundView into my macOS application but unable to make the LookAroundView interactive at all. I can get it to display a static image, but there's no interactivity at all and no controls visible.
This is using the SwiftUI LookAroundPreview view as well as trying to wrap MKLookAroundViewController inside an NSViewRepresentable.
The navigation properties are set to true but that doesn't seem to make a difference. Would love to incorporate this feature but without interactivity its value is limited.
macOS 15.4.1 (24E263), Xcode Version 16.3 (16E140)
This question has been asked several times by other users before. But there is no solution provided it seems. So I am asking the same here. I have a screen where I add mapview as a subview. In that it is showing instead of "Legal".
I have an error issue that I haven’t been able to solve despite doing extensive research. In fact the similar examples I have found so far have been educational but I have not been able to make work. The example below I am hoping will be easy to fix as it is only producing errors with one line of code…
import SwiftUI
import CoreLocation
var currentLon = Double()
var currentLat = Double()
extension CLLocation {
class func distance(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) -> CLLocationDistance {
let from = CLLocation(latitude: from.latitude, longitude: from.longitude)
let to = CLLocation(latitude: to.latitude, longitude: to.longitude)
return from.distance(from: to)
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
currentLon = (locations.last?.coordinate.longitude)!
currentLat = (locations.last?.coordinate.latitude)!
}/*⚠️ Not sure if this function will work? (Update User Location coordinates on the move?)*/
}
struct Positions: Identifiable {
let id = UUID()
let name: String
let latitude: Double
let longitude: Double
var coordinate: CLLocationCoordinate2D {
CLLocationCoordinate2D(latitude: latitude, longitude: longitude)
}
}
struct GameMapView: View {
let from = CLLocationCoordinate2D(latitude: currentLon, longitude: currentLat)
let to = CLLocationCoordinate2D(latitude: thisCardPositionLongitude, longitude: thisCardPositionLongitude)
let distanceFrom = from.distance(from: to)
/*⚠️ ERRORS:
1. Cannot use instance member 'from' within property initializer; property initializers run before 'self' is available.
2. Cannot use instance member 'to' within property initializer; property initializers run before 'self' is available.
3. Value of type 'CLLocationCoordinate2D' has no member 'distance'. */
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(
latitude: thisCardPositionLatitude,
longitude: thisCardPositionLongitude),
span: MKCoordinateSpan(
latitudeDelta: 0.0001,
longitudeDelta: 0.0001)
)
var body: some View {
Map(coordinateRegion: $region,
showsUserLocation: true,
annotationItems: locations){ place in
MapMarker(coordinate: place.coordinate,tint: Color.accentColor)
}
.edgesIgnoringSafeArea(.all)
VStack {
Print("Distance from Location: \(distanceFrom)")
font(.largeTitle)
padding()
}
Topic:
App & System Services
SubTopic:
Maps & Location
Tags:
Swift Playground
Swift
MapKit
Maps and Location
I'm working on an app that uses MapKit and CoreLocation. Is there a way to specify what location is simulated for a Preview, or create a preview that behaves as if the user denied location permissions, so that I can easily test my app's behavior in different scenarios? I know that you can simulate different locations in the Simulator, but haven't been able to get the previews within Xcode to have a location other than the center of Apple Park.
I want to create a MKRoute from a list of MKMapPoints or coordinates. But apparently MKRoute can only be generated from a MKDirections request from Apple's servers.
The primary use of my app will be activities (eg hiking) in the back country where (1) a network connection likely won't be available and (2) there likely will not be a trail in Apple's map network.
For example I want to provide navigation for following a recorded GPS track or my only MKPolyLines.
Note that I am required to use MapKit (3rd party map SDKs are not an option for a number of reasons). It feels like a huge missed opportunity if MapKit doesn't allow Routes to be created from a predetermined list of coordinates.
Does anyone know of any solutions for this problem either somehow creating a MKRoute from a list of coordinates or a 3rd party library? I've searched but haven't had any luck finding a solution. It seems like something like this must exist so I thought I'd ask.
Hi everyone! I am having a bit of trouble with why my Map() is overwriting my customized tabBar settings. Specifically my tab bar background. (White -> Black)
Map(position: $cameraPosition) {
UserAnnotation()
}
.toolbarBackground(.hidden, for: .tabBar)
This above ^ is a view which acts as a tab view for my tab bar. I have customized my tab bar as follows just so it was obvious to see me changes.
let tabAppearance = UITabBarAppearance()
tabAppearance.configureWithOpaqueBackground()
tabAppearance.backgroundColor = .white
UITabBar.appearance().standardAppearance = tabAppearance
UITabBar.appearance().scrollEdgeAppearance = tabAppearance
I have tried implementing solutions which is seen with my .toolbar attempt but nothing has help. I would like the tab bar to be consistent with all of my views and from my understanding the Map is overwriting those settings.
We are experiencing an issue where our app gets stuck during launch. The splash screen appears for some time, and then the app either becomes unresponsive or closes unexpectedly. However, there are no crash logs captured in Xcode or Firebase Crashlytics, indicating that the app is not crashing but rather being terminated. This issue is preventing affected users from properly launching the app.
Additionally, some users have reported occasional lag and slow performance when using the app. The issue occurs only for a specific subset of users and appears to be related to other Electronic Logging Device (ELD) apps running in the background. When these apps are active, our app struggles to launch and sometimes becomes unresponsive.
We suspect that this behavior could be related to system resource allocation, such as high memory consumption by background apps, which might be affecting our app's ability to launch correctly. However, we have been unable to reproduce the issue on our end despite multiple attempts.
Actions Performed During App Launch:
Firebase configuration
API requests, including:
Fetching account details
Registering the FCM token with the server
Asynchronous background requests to fetch POI details
Creating a local database and storing POI data in local storage
We would like guidance from Apple regarding potential causes and debugging strategies, especially in scenarios where the app does not produce crash logs but still fails to launch properly. Any insights into memory management, conflicts with background applications, or system resource constraints would be highly appreciated.
Steps to Reproduce:
Install and launch the app on an affected device.
Observe that the app gets stuck on the launch screen.
After some time, the app terminates unexpectedly.
Issue is inconsistent and occurs only for certain users.
Presence of other ELD apps running in the background appears to influence the issue.
I'm trying to evaluate if we can support AR navigation with MapKit. The feature is supposed to be available for users in US.
I tried to run the sample on my iPhone: https://developer.apple.com/documentation/arkit/tracking-geographic-locations-in-ar?language=objc
But I'm in a location that ARGeoTrackingConfiguration.checkAvailabilityWithCompletionHandler: always return false. I think ARGeoAnchor isn't supported in my location.
I tried to use simulated locations by
Adding a gpx file when launching the app.
Enabling Xcode -> Debug -> Simulate Location -> New York, NY, US
But the availability for ARGeoAnchor is still false.
Is that possible for me to develop the ARGeoAnchor feature outside of the covered areas?
This is the complete Playground code:
import MapKit
import SwiftUI
import PlaygroundSupport
struct AddressSearchView: View {
@State private var region = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 37.7749, longitude: -122.4194),
span: MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01)
)
var body: some View {
VStack {
Map(position: .constant(MapCameraPosition.region(region))) {
}
.frame(height: 300)
}
}
}
struct AddressSearchView_Previews: PreviewProvider {
static var previews: some View {
AddressSearchView()
}
}
PlaygroundPage.current.setLiveView(AddressSearchView())
When I try to run this I get this in the debug console:
error: Couldn't look up symbols:
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
protocol witness table for _MapKit_SwiftUI.EmptyMapContent : _MapKit_SwiftUI.MapContent in _MapKit_SwiftUI
Hint: The expression tried to call a function that is not present in the target, perhaps because it was optimized out by the compiler.
the preview never shows up. If I use other SwiftUI components and not the map it works fine. What is happening?
Playground target is Swift 6 macOS (iOS does the same).
Xcode 16.2
Hi all,
here's a tiny litte demo app
import SwiftUI
import MapKit
struct MarkerData: Identifiable {
var id = UUID()
var coordinate: CLLocationCoordinate2D
}
struct MapView2: View {
@State private var markers: [MarkerData] = []
var body: some View {
ForEach(markers) { marker in
Text("\(marker.coordinate)")
}
Map {
ForEach(markers) { marker in
MapMarker(coordinate: marker.coordinate)
}
}
}
}
The ForEach loop inside the Map gives the error:
"Generic parameter 'V' could not be inferred"
The one above seems to be fine.
What is wrong with the loop inside the map?
(I'm working with XCode Version 16.2)
Best!
I'm implementing a Map with user location customization in SwiftUI using iOS 17+ MapKit APIs. When using the selection parameter with Map, the default blue dot user location becomes tappable but shows an empty annotation view. However, using UserAnnotation makes the location marker non-interactive.
My code structure:
import SwiftUI
import MapKit
struct UserAnnotationSample: View {
@State private var position: MapCameraPosition = .userLocation(fallback: .automatic)
@State private var selectedItem: MapSelection<MKMapItem>?
var body: some View {
Map(position: $position, selection: $selectedItem) {
// UserAnnotation()
}
.mapControls {
MapUserLocationButton()
}
}
}
Key questions:
How can I replace the empty annotation view with a custom avatar when tapping the user location?
Is there a way to make UserAnnotation interactive with selection?
Should I use tag modifier for custom annotations? What's the proper way to associate selections?
Hello,
Probably a noob question but I can't find any example code around this use case, and really no past questions I could find that address it either.
So, I really love that, when a user taps a POI on the map in my app, the map figures out the right POI every time. Flawless. However, when using .mapFeatureSelectionAccessory, I've tried probably 10-12 iterations, and there doesn't seem to be any way to either:
a) add custom content to the place card that's shown, or
b) replace that place card altogether with a view of my own, or
c) capture the place data but use it in a custom view
I want to be able to leverage the accuracy of Apple's tap gesture detection, but show, for example, only the name of the place, along with buttons and a form I have in a view.
Right now if I'm using .mapFeatureSelectionAccessory, I can't seem to bypass the place card at all.