Maps & Location

RSS for tag

Learn how to integrate MapKit and Core Location to unlock the power of location-based features in your app.

Maps & Location Documentation

Posts under Maps & Location subtopic

Post

Replies

Boosts

Views

Activity

Empty `safeAreaInset` modifier breaks `Map` zoom region
Reported as FB20357097 In SwiftUI, an empty .safeAreaInset modifier attached to a Map causes the map to become zoomed out to planet level. Minimal reproduction: import SwiftUI import MapKit @main struct map_region_safe_area_inset_bugApp: App { var body: some Scene { WindowGroup { Map { // Any Map content MapCircle(center: .init(latitude: 35.6895, longitude: 139.6917), radius: 1000) } .safeAreaInset(edge: .top) { // No content, `EmptyView()`, `Color.clear` } } } } Note: ZStack { } inside the safeAreaInset prevents the bug. Empty safeAreaInset (bug) Non-empty
0
0
31
1w
com.apple.corelocation.shared Crash after implementation of live updates
After the implementation of liveUpdates(_:) to receive asynchronous sequence of location updates, we are receiving crash reports on a huge number of users. However we cannot reproduce the crash so any help is much appreciated. This is the stack trace: com.apple.main-thread 0 libsystem_kernel.dylib 0xce4 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x439c mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x42b8 mach_msg_overwrite + 428 3 libsystem_kernel.dylib 0x4100 mach_msg + 24 4 CoreFoundation 0x717b0 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x70e90 __CFRunLoopRun + 1208 6 CoreFoundation 0x957f0 CFRunLoopRunSpecific + 572 7 GraphicsServices 0x1190 GSEventRunModal + 168 8 UIKitCore 0x3ca158 -[UIApplication _run] + 816 9 UIKitCore 0x3c8388 UIApplicationMain + 336 10 atto 0x6a41a0 main + 25 (AppDelegate.swift:25) 11 ??? 0x1ac153a58 (Missing) com.apple.uikit.eventfetch-thread 0 libsystem_kernel.dylib 0xce4 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x439c mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x42b8 mach_msg_overwrite + 428 3 libsystem_kernel.dylib 0x4100 mach_msg + 24 4 CoreFoundation 0x717b0 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x70e90 __CFRunLoopRun + 1208 6 CoreFoundation 0x957f0 CFRunLoopRunSpecific + 572 7 Foundation 0x74728 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 8 Foundation 0x73558 -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 9 UIKitCore 0x4bd354 -[UIEventFetcher threadMain] + 424 10 Foundation 0x115f40 NSThread__start + 732 11 libsystem_pthread.dylib 0x1afc _pthread_start + 136 12 libsystem_pthread.dylib 0x1a04 thread_start + 8 com.google.firebase.crashlytics.MachExceptionServer 0 FirebaseCrashlytics 0x21c10 FIRCLSProcessRecordAllThreads + 184 1 FirebaseCrashlytics 0x21ff0 FIRCLSProcessRecordAllThreads + 1176 2 FirebaseCrashlytics 0x18e74 FIRCLSHandler + 48 3 FirebaseCrashlytics 0x1b804 FIRCLSMachExceptionServer + 688 4 libsystem_pthread.dylib 0x1afc _pthread_start + 136 5 libsystem_pthread.dylib 0x1a04 thread_start + 8 com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0xce4 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0x439c mach_msg2_internal + 76 2 libsystem_kernel.dylib 0x42b8 mach_msg_overwrite + 428 3 libsystem_kernel.dylib 0x4100 mach_msg + 24 4 CoreFoundation 0x717b0 __CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x70e90 __CFRunLoopRun + 1208 6 CoreFoundation 0x957f0 CFRunLoopRunSpecific + 572 7 CFNetwork 0xeba68 +[__CFN_CoreSchedulingSetRunnable _run:] + 416 8 Foundation 0x115f40 NSThread__start + 732 9 libsystem_pthread.dylib 0x1afc _pthread_start + 136 10 libsystem_pthread.dylib 0x1a04 thread_start + 8 Thread 0 libsystem_kernel.dylib 0xa90 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x46ac _pthread_wqthread + 368 2 libsystem_pthread.dylib 0x19f8 start_wqthread + 8 Crashed: com.apple.corelocation.shared 0 libobjc.A.dylib 0x2050 objc_release_x8 + 16 1 libsystem_blocks.dylib 0x1d30 bool HelperBase::disposeCapture<(HelperBase::BlockCaptureKind)3>(unsigned int, unsigned char*) + 68 2 libsystem_blocks.dylib 0x16a8 HelperBase::destroyBlock(Block_layout*, bool, unsigned char*) + 116 3 libsystem_blocks.dylib 0x1180 _call_dispose_helpers_excp + 72 4 libsystem_blocks.dylib 0x111c _Block_release + 236 5 libsystem_blocks.dylib 0xff4 bool HelperBase::disposeCapture<(HelperBase::BlockCaptureKind)4>(unsigned int, unsigned char*) + 68 6 libsystem_blocks.dylib 0x16f8 HelperBase::destroyBlock(Block_layout*, bool, unsigned char*) + 196 7 libsystem_blocks.dylib 0x1180 _call_dispose_helpers_excp + 72 8 libsystem_blocks.dylib 0x111c _Block_release + 236 9 libdispatch.dylib 0x1b4f8 _dispatch_client_callout + 16 10 libdispatch.dylib 0xa2cc _dispatch_lane_serial_drain + 736 11 libdispatch.dylib 0xad90 _dispatch_lane_invoke + 380 12 libdispatch.dylib 0x15178 _dispatch_root_queue_drain_deferred_wlh + 292 13 libdispatch.dylib 0x149fc _dispatch_workloop_worker_thread + 540 14 libsystem_pthread.dylib 0x4660 _pthread_wqthread + 292 15 libsystem_pthread.dylib 0x19f8 start_wqthread + 8 Thread 0 libsystem_pthread.dylib 0x19f0 start_wqthread + 142 Thread 0 libsystem_pthread.dylib 0x19f0 start_wqthread + 142 Thread 0 libsystem_pthread.dylib 0x19f0 start_wqthread + 142
1
0
256
Feb ’25
Search.autocomplete coordinates vs Geocoder.reverseLookup coordinates are inconsistent and incorrect results
When using Search.autocomplete and getting the results, each search result object has coordinate which have 13 decimal places. When you use Geocoder.reverseLookup for these coordinates, it returns the wrong address and different coordinates (6 decimal places and different as well). What works is using Geocoder.lookup (with getsUserLocation as true) and putting in the Search.autocomplete displayLines (as a string) for the query. Am I doing something wrong or is this a bug? Code: const exampleQuery = '<example address>'; const search = new mapkit.Search({ getsUserLocation: true, }); search.autocomplete( exampleQuery, (error, data) => { if (error) { console.error('Search error:', error); return; } const { coordinate } = data.results[0]; console.log("Autocomplete coordinate", coordinate); // Lat and lng are both have 13 decimal places const geoCoder = new mapkit.Geocoder({}); geoCoder.reverseLookup( new mapkit.Coordinate(coordinate.latitude, coordinate.longitude), (error, data) => { const { formattedAddress, coordinate } = data.results[0]; console.log(formattedAddress, coordinate); // Not the same address from example query and from the search autocomplete, also the coordinate has 7 decimal places } ); }, {} );
0
0
496
Nov ’24
Traffic Events API
Hello developers! I am working with a team of North Carolina State University researchers to create an app or program that can retrieve real-time traffic events, such as hazards, road closures, and road construction alerts, in a similar manner to the Apple Maps app, but with the added functionality of collecting them over a historical period given a start and end date. I'm looking through the MapKit documentation, but there doesn't appear to be any functions exposing granular traffic data (i.e. road hazards), just travel times and level of congestion. Could anyone point me in the right direction? Is what I'm looking to do even possible using just Apple data?
0
0
174
Mar ’25
Iphone is deleting my messages automatically
I have checked the setting and it is and has always been set to forever when it comes to settings-messages-message history. Yet since I upgraded to ios 18.1, my messages have started to delete by themselves every other day or so. In the last week, I have had to go into the recently deleted and recovered the messages at least 3-4 times. It does not delete all my messages just random messages from whom I have messaged recently. I have message that have been there for at least 6 years and those are not deleting. Please help before I lose some valuable messages.
1
0
725
Oct ’24
Details on CLBackgroundActivitySession and CLServiceSession Diagnostic enum
I am working with the CLBackgroundActivitySession and CLServiceSession to figure out why our app is sometimes terminated in the background. I am unable to understand what "insufficientlyInUse" corresponds to, it could be understood as The location data is not being used enough the "While in use" permission is not enough It will be very helpful if the entire enum can be explained, I am attaching the one for CLServiceSession since it is a superset of CLBackgroundActivitySession from CoreLocation extension CLServiceSession { public struct Diagnostic { public var authorizationDenied: Bool { get } public var authorizationDeniedGlobally: Bool { get } public var authorizationRestricted: Bool { get } public var insufficientlyInUse: Bool { get } public var fullAccuracyDenied: Bool { get } public var alwaysAuthorizationDenied: Bool { get } public var serviceSessionRequired: Bool { get } public var authorizationRequestInProgress: Bool { get } } ... } Looking forward to hearing from you
2
0
598
Nov ’24
Apple Maps really sluggish
After upgrading to iOS 18.1, apple maps is really slow. I thought it was the app so I switched to google maps and same issue. I have tried all (including reseting the iPhone) but it did not fix it. I had iPhone 15 proMax, but since nothing worked, I upgraded to i16 but .... nothing. Any idea on how to get it fixed?
1
0
521
Nov ’24
transportType .transit does not work
hi, does someone encounter this problem, this is sample code : let request = MKDirections.Request() request.source = MKMapItem(placemark: startPlacemark) request.destination = MKMapItem(placemark: endPlacemark) request.transportType = .transit // .transit does not work I want to make a route with two point(startPlacemark and endPlacemark ), when I give request.transportType the value of **.transit ** ,I found it not work, ps: .automobile .walking works well , my Xcode version is 16 .
0
0
262
Oct ’24
How to Handle Periodic Background Location Reminders for an MDM-Managed Safety App?
Hello everyone, We've developed a safety application for schools that runs on supervised, MDM-managed iOS devices. The app requires "Location Always" to maintain a persistent background state for its core functionality. The Challenge: Our primary issue is with the periodic background location reminder prompts that iOS automatically presents to the user (e.g., "[App Name] has used your location X times in the past 3 days..."). A screenshot of the exact prompt is attached. While we educate users on the importance of selecting "Always Allow," these recurring prompts make it very easy for a student to downgrade the permission at a later date, which disables the app's safety features. This makes the solution unreliable in a school environment. Our Question: Since these are supervised devices managed by an educational institution, we are looking for a way to manage this behavior. Is there any Info.plist key, entitlement, or API available to developers to influence or suppress these recurring location reminders for our app? From an MDM perspective, is there a known payload or declarative management configuration that can prevent these specific prompts from appearing for a designated app? We understand these prompts are a key privacy feature. Our question is whether there are any provisions for managed, special-purpose environments like a school, where the app's function is considered essential and pre-approved by the device administrator (the school). We are looking for a way to provide a "set it and forget it" configuration for the school, but these reminders currently prevent that. Any architectural advice or insights would be greatly appreciated. Thank you.
2
0
95
Jul ’25
Notification Delivery Issues for Location Push Service Extension
We are currently testing the implementation of our Location Push Service Extension (LPSE) in both Ad Hoc and Release environments. We have encountered an issue where LPSE notifications, which were previously working correctly, suddenly fail to be delivered on some devices. After a period of several hours, the notifications resume arriving, but the issue remains intermittent. Notably, during these periods of suspected delivery restriction, regular push notifications (e.g., those using apns-push-type: alert) are delivered and displayed without any problem. [Detailed Situation] Test Environment and Scope We are testing LPSE after obtaining the necessary entitlements, in both Ad Hoc and Release environments. The issue is not observed on all test devices; only certain devices are affected. Observed Behavior Under normal circumstances, LPSE notifications are received and the extension is activated; however, on some devices the notifications suddenly stop arriving. During these periods, even when sending notifications with apns-push-type: location directly via the CloudKit Push Notification Console, no response is observed on the affected devices. The APNs server (api.push.apple.com) always returns a 200 OK response via HTTP/2, and our server-side logs and configurations (DNS resolution performed on every request, using the same JWT token for 59 minutes per session, communication via HTTP/2 with ALPN Protocol: h2) show no issues. Other app functionalities (network communication, UI responsiveness, etc.) work normally. Sending content When sending notifications from our server to APNs (api.push.apple.com), we use the following configuration (over HTTP/2): const payload = { aps: { 'content-available': 1 } }; const headers = { ':method': 'POST', ':path': /3/device/${apnsToken}, 'Authorization': bearer ${jwtToken}, 'apns-topic': 'ot.Here.location-query', 'apns-priority': '10', 'apns-push-type': 'location', 'Content-Type': 'application/json' }; We perform DNS resolution for every request, use the same JWT token for a 59-minute period per session, and communicate via HTTP/2 with ALPN Protocol: h2. Hypothesis on the Cause We suspect that due to an implementation issue, silent push notifications (using content-available: 1) were being sent every few minutes concurrently, which may have triggered an APNs delivery restriction (rate limiting). As a countermeasure, we have completely stopped sending silent pushes and any other background notifications aside from LPSE; however, the issue persists. Additionally, even after resetting affected devices, the delivery problem continues to occur. [Questions for Diagnosis] Given the above situation, is it reasonable to suspect that excessive silent push notifications have triggered an APNs delivery restriction? Does such a silent push restriction affect LPSE notifications (i.e., those sent with apns-push-type: location)? Do APNs delivery restrictions persist even after a device has been reset? Can a high volume of LPSE notifications alone (without silent pushes) also trigger a delivery restriction? → This is our primary concern since it poses a significant implementation challenge. Please let us know if any additional information is required for diagnosis.
3
0
86
Mar ’25
bicycle mode to navigate
MKLaunchOptionsDirectionsModeDefault MKLaunchOptionsDirectionsModeDriving MKLaunchOptionsDirectionsModeWalking MKLaunchOptionsDirectionsModeTransit when I am using the mapkit navigation, I only see the 4 modes, but can not find the mode of bicycle, so how can I find the enum of using bicycle to navigate by bicycle ,than you!~ Xcode version is 16.
0
0
329
Oct ’24
How to Reduce Geolocation Drifting Inside Buildings on iOS?
I am developing a Flutter app that uses geolocation data extensively. While the location accuracy is excellent under an open sky, I’ve noticed significant drifting when users are inside large buildings. This impacts the app’s functionality as precise location data is critical. I would like to know: Are there any specific configurations or APIs available in the Apple ecosystem to enhance indoor geolocation accuracy? Would combining GPS with other location technologies (like Wi-Fi or Bluetooth) reduce drifting effectively? Are there recommended practices for handling geolocation indoors on iOS? Any advice, examples, or guidance would be greatly appreciated!
1
0
343
Jan ’25
Guidance on Continuous Location & Direction Updates to watchOS App Without Screen Dimming
Dear Apple Developer Support, I am reaching out for guidance on implementing continuous directional and location updates in a watchOS app designed as part of a mapping/navigation solution. Current Scenario: We send continuous location and direction updates from our iOS app to the watchOS companion app. When viewing directions on the Apple Watch, the screen dims after a short period, and the live data stops updating consistently, even though the user is actively looking at the screen. This negatively impacts the usability of real-time navigation on watchOS. Our Objective: Prevent screen dimming (or extend screen-on time) while the user is viewing navigation directions. Ensure reliable, continuous data updates on the watch screen during active navigation sessions. Request: We would appreciate your guidance on: The recommended method to keep the watchOS screen active while displaying real-time navigation data. Proper use of APIs such as WKExtendedRuntimeSession, WorkoutSession, or any other mechanism suitable for this use case. Any best practices or App Store review considerations for apps that require extended screen time and continuous updates. How such use cases were traditionally handled on watchOS and what has or hasn’t worked. We want to ensure we're implementing this in a battery-efficient, user-respectful, and Apple-compliant manner. Thank you for your assistance and guidance.
1
0
63
Apr ’25