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

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
167
Mar ’25
How to update business information on Apple Maps Ukraine?
Hello everyone, I need help updating business information on Apple Maps for locations in Ukraine. Unfortunately, the usual methods, like "Report an Issue" in the Maps app or using Apple Business Connect, don’t seem to be working properly for Ukrainian businesses. Many locations have outdated or missing details, which is frustrating for both business owners and customers. Given the current situation, keeping information accurate is more important than ever. Has anyone successfully updated business listings in Ukraine recently? If so, could you share the process or any contacts that might help? Any advice would be greatly appreciated! Thanks in advance!
1
0
243
Mar ’25
CBCentralManager connection in background.
Hello, I’m experiencing an issue with my iOS app that uses CoreBluetooth in combination with beacon monitoring. My app is designed to wake via beacon region monitoring and then start scanning for a specific BLE peripheral (with specific service UUIDs). When the device screen is bright (i.e., the device is unlocked, or locked but the screen is active/bright), everything works perfectly—the connection is established and maintained without any issues in both: foreground and background. However, when the device is left alone for a while and the lock-screen dims (sleeps), the app continues to run in the background and range the beacon (I can confirm this via realtime console logs), but the connection attempt fails. Here’s what I observe: The central manager’s delegate method didConnect is called, indicating that the peripheral was connected. Almost immediately afterward, didDisconnect is triggered with the error message: "The specified device has disconnected from us.". The interesting part is (I repeatedly see this error in the console, because the app repeatedly tries to connect to peripheral until a success), when I touch the lockscreen (not unlock, but just touch, which makes the screen to light up brighter), the connection is being established without any further issues! I have the necessary background modes enabled in the app’s capabilities (e.g., bluetooth-central, location-always-mode, etc..). My expectation was that, thanks to beacon monitoring, the app would be awakened when needed, and scanning/connection would work reliably in the background regardless of whether the device is active or dimmed. My questions are: Why might the connection fail with this error when the device is locked/dimmed? Is this behavior expected due to iOS power management policies even if the app remains active in the background? Is there a way to ensure a reliable connection in such cases? Any insights, workarounds, or suggestions would be greatly appreciated. Thank you in advance!
2
0
320
Mar ’25
The App Remembers Location Access Permission only for 24 Hours
We have a PWA app developed by our company. In order to distribute this app to users' iPhones, we put this PWA app inside an XCode app. That means we put a WebView in XCode to display the PWA URL. Everything works perfect, except for location access. The PWA app access the device location. When the first time the app acess location, it asks for user consent two times, by PWA app and by the XCode app. This is fine. When the user clicks Allow, the XCode app preserves the user choice and never asks again. However, the PWA app keeps on asking user permission every day. If we close the app open again, it will ask one more time. That means twice daily. But if we close and open the app for a third time, it will not ask. It remembers the user choice only for 24 hours. If we install the PWA app directly in iPhone (that means if we add the URL as bookmark in home screen), it is asking for location permission only once. However, when we put this app inside an XCode app it is asking every day. This affects the user experience, and as our users are not tech savvy, causing many issues. Is there a way to force the PWA app inside XCode app to remember the user choice? Any help is very much appreciated. Thanks,
0
0
283
Mar ’25
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
235
Feb ’25
MapKit: Customize view shown by .mapFeatureSelectionAccessory
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.
1
0
236
Feb ’25
Bachelor Thesis -Geolocation
Hello, I write a Bachelor-Theses about Geolocation on an iPhone. I have a ******-generator from R&S to simulate GPS-Data. I write an App on an Android-Phone and can readout the GPS-ID and the strength from the ****** and the time and Position for Geolocation zb. Island or Africa like this. Now my thesis is about the iPhone and I write an App for get the location manager Geolocation and to save it to a sqlite-database with longitude, latitude and time. But the App recognizes only the real world for geolocation on GPS (LTE and Wlan are disabled!). With my Radio-Generator it would not recognize any Geolocation like the Android phone.? So I need some fast help for my thesis, where are my problems? I allready have a function like this: func updateAccuracy(highAccuracy: Bool) { locationManager.desiredAccuracy = highAccuracy ? kCLLocationAccuracyBestForNavigation : kCLLocationAccuracyHundredMeters print("🎯 GPS-Genauigkeit geändert: (highAccuracy ? "Hoch" : "Plane-Genauigkeit")") } but nothing happens? Best regards
1
0
301
Feb ’25
Keep tracking user driving sessions when the app is killed.
I want a solution to keep tracking the user once he started in driving state until parking. I tried many solutions like use significant location changes, and silent push notifications and background tasks, but no one of them worked as expected. I need when user started in driving the app be active until the user parked his car. I'm using CoreMotion and CoreLocation. The challenge is when the app is not active like killed or suspended. So, how to do this? is this possible or not?
1
0
371
Feb ’25
MapPolygon
I recently converted over my map from Mapbox Maps to MapKit Map. I have been able to add my polygons on the Map using MapPolygon. The issue I am having is being able to select the Polygon to be able to view information about the polygon. Has anyone been able to figure out a way to tap on the Polygon? I have tried selection but the Polygon doesn't recognize the tap. I would really appreciate it if anyone could point me in the right direction of how I can accomplish this.
1
0
324
Feb ’25
Background BLE Scanning with Navigation Mode - Technical Feasibility for Safety Monitoring App
First of all, my English skills are not good, so I wrote an AI program and sent it to complete the questions. sorry. I'm developing a safety monitoring application that requires continuous BLE scanning for temperature and humidity sensors. I need clarification on the technical feasibility of background and sleep mode operation. Key Requirements: Continuous monitoring of BLE advertisements from temperature/humidity sensors Must detect critical temperature/humidity changes immediately Data logging every minute Includes navigation features showing routes Technical Questions: Background Mode Operation If using background modes (bluetooth-central + location): Can we receive BLE advertisements reliably? What is the actual scanning interval limitation? Will CBCentralManagerScanOptionAllowDuplicatesKey limitation affect critical monitoring? Sleep Mode Operation Can the app maintain BLE scanning during device sleep? Would combining with navigation background mode help? Are there any recommended approaches for continuous monitoring? Sample Code of Current Approach: let options: [String: Any] = [ CBCentralManagerOptionShowPowerAlertKey: true, CBCentralManagerOptionRestoreIdentifierKey: "uniqueIdentifier" ] centralManager = CBCentralManager(delegate: self, queue: nil, options: options) // Scanning setup centralManager.scanForPeripherals( withServices: [serviceUUID], options: [CBCentralManagerScanOptionAllowDuplicatesKey: true] ) Has anyone successfully implemented continuous BLE monitoring in background/sleep modes? Are there any special entitlements or techniques that could help achieve this? This is for a safety-critical application where missing sensor data could lead to serious issues. Any guidance would be greatly appreciated.
1
0
342
Feb ’25
Simulator Location Authorization Issue: Authorization Status Remains notDetermined After Denying and Changing in System Settings
Hello everyone, I'm encountering a strange location authorization issue in the iOS simulator, and I'm hoping someone can help me analyze it. Problem Description: When my app runs for the first time in the simulator, it requests location permissions. I select "Deny" for the authorization. Then, I go to the simulator's "Settings" -&gt; "Privacy &amp; Security" -&gt; "Location Services" and enable location permissions for my app. However, when I return to the app, CLLocationManager.authorizationStatus still returns .notDetermined, and the authorization request pop-up does not appear again. This issue persists even after resetting the simulator settings multiple times. import CoreLocation @Observable final class LocationManager: NSObject, CLLocationManagerDelegate { var locationManager = CLLocationManager() var currentLocation: CLLocationCoordinate2D? override init() { super.init() locationManager.delegate = self } func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { let status = manager.authorizationStatus print("Authorize Status: \(status)") switch status { case .authorizedWhenInUse, .authorizedAlways: locationManager.startUpdatingLocation() case .denied, .restricted: stopLocation() case .notDetermined: locationManager.requestWhenInUseAuthorization() print("Location permission not determined.") @unknown default: break } } func requestLocation() { let status = locationManager.authorizationStatus if status == .authorizedWhenInUse || status == .authorizedAlways { locationManager.requestLocation() } else { locationManager.requestWhenInUseAuthorization() } } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { guard let newLocation = locations.first else { return } currentLocation = newLocation.coordinate print("Updated location: \(newLocation.coordinate)") } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { print("Location update failed with error: \(error.localizedDescription)") currentLocation = nil } func stopLocation() { locationManager.stopUpdatingLocation() print("Stopped updating location") } }
0
0
410
Feb ’25
A symbol on Apple Maps, how can I show it in MapKit
The easiest way to explain this is to show it. On any device, open Maps, set it to Driving (which will show traffic). Go to Baltimore Maryland. In the water just south east of the city there is a bridge (Francis Scott Key Bridge). . On Apple Maps the road is colored dark red. At certain zoom levels, there is a "button" (red circle with a white - in it). When you click on that "button", it says 1 Advisory (Road Closed). How do I show this "button" on my map. My map shows the dark red color, but no "button" appears. The only "advisory" that I've been able to find is when you create a route. Of course you can't create a route over a road that fell into the water. struct ContentView: View { @State private var position = MapCameraPosition.region( MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: 39.22742855118304, longitude: -76.52228412310761), span: MKCoordinateSpan(latitudeDelta: 0.05407607689684113, longitudeDelta: 0.04606660133347873) ) ) var body: some View { Map(position: $position) .mapStyle(.standard(pointsOfInterest: .all, showsTraffic: true)) .cornerRadius(25) } } Is this a WCDWAD, or is there a way to show the "button" (We Can't Do What Apple Does)
5
0
369
Feb ’25
Offline Mapkit tiles
I'm currently developing an app with mapkit which I may submit to the Swift Student Challenge. So anyways, the app will be used completely offline. I was wondering if there was any way to include very low resolution map tiles with the app files. That way, the app never needs wifi. However, I'm not sure if this is possible, especially since the map would need to be under 20 mb. Thanks.
0
0
263
Feb ’25
CMAltimeter becomes somehow uncalibrated: absolute locations not delivered anymore (temporarily)
Note: I have had issues with CMAltimeter since whats seems to have been a major undocumented modification since iOS 17.4. So I'm using the CMAltimeter absolute locations delivery. Sometimes, the altimeter seems to be in an uncalibrated mode and therefore, no altitude delivery happens. Is there a way to be inform of such state? Currently, it just doesn't work and I can't inform the user about this. They just think the app is broken What message should I give to the users to accelerate the calibration such that the CMAltimeter will work again? Also, users have reported that the CMAltimeter can temporarily stop delivering altitude updates, even though it should. So I guess my question resumes to this: Whats the best practice to handle an uncalibrated CMAltimeter? Thanks!
0
0
264
Feb ’25
Checking Wi-Fi Status for Location Accuracy in iOS App
I am working on a duress app and would like to improve location accuracy by encouraging users to enable Wi-Fi. In Apple Maps, I noticed that when Wi-Fi is off, a dialog prompts users to turn on Wi-Fi to enhance location accuracy. I am looking to implement similar functionality in my app. Specifically, I would like to check whether Wi-Fi is enabled on the user's device (even if it is not connected to a network). Despite exploring several methods, I have been unable to determine a reliable way to check the Wi-Fi status. Can you guide me on whether it is possible to access this functionality in iOS, and if so, how I can implement it within my app?
2
0
415
Feb ’25
Underground location (in subway) doesn't update properly
We (at the NYC MTA) are building a new subway/bus app and diving deep into location tracking on iOS. We’re encountering an issue with how Core Location functions in the subway, specifically regarding how long it takes to update a passenger’s location as they travel from station to station. As an example, please see this video: https://drive.google.com/file/d/1yaddkjyPEETvTEmClPAJ2wks8b-_whqB/view?usp=sharing The red dot is set manually (via a tap gesture) and represents the ground truth of where the phone actually is at that moment. The most critical moment to observe is when the train physically arrives at a station (i.e., when I can see the platform outside my window). At this moment, I update the red dot to the center of the station on the map. Similarly, I adjust the red dot when the train departs a station, placing it just outside the station in the direction of travel. The trip shown is from Rector St to 14 St. All times are in EST. I’d like to investigate this issue further since providing a seamless underground location experience is crucial for customers. As a point of comparison, Android phones exhibit near-perfect behavior, proving that this is technically feasible. We want to ensure the iOS experience is just as smooth.
4
0
428
Feb ’25
LookAroundPreview navigation not working on macOS
The code below using LookAroundPreview works fine on iOS (showing the preview image with a button saying "Look Around" at the top to enter full screen with navigation), but on macOS (15.3) there is no button and no way to navigate the view. Is this a bug or is there something I need to do differently on macOS? I have also tried using AppKit with MKLookAroundViewController and I don't seem get the button to launch full screen there either. import SwiftUI import MapKit struct ContentView: View { var body: some View { LookAroundPreviewView(coordinate: CLLocationCoordinate2D(latitude: 37.33182, longitude: -122.03118)) .frame(width: 300, height: 200) } } struct LookAroundPreviewView: View { let coordinate: CLLocationCoordinate2D @State private var scene: MKLookAroundScene? @State private var errorMessage: String? var body: some View { Group { if scene != nil { LookAroundPreview(scene: $scene, allowsNavigation: true) } else if let errorMessage = errorMessage { Text("Error: \(errorMessage)") .foregroundColor(.red) } else { ProgressView("Loading Look Around Preview...") } } .task { do { let request = MKLookAroundSceneRequest(coordinate: coordinate) let fetchedScene = try await request.scene scene = fetchedScene } catch { errorMessage = error.localizedDescription print("Error loading Look Around scene: \(error)") } } } }
1
0
326
Feb ’25
Location not tracking in background
I really need some help. I have been going back and forth with a customer of mine for weeks. Our app is supposed to track location in the background after a user starts it in the foreground. Every time I test it, it works. I can put the app in the background and walk around for hours. Every time he tests it, it doesn't work. He puts the app into the background and about a minute later, it stops tracking him. Then it starts again when the app comes back to the foreground. We have each tried it on two devices with the same results. I'm willing to post the rest of the details if anyone is interested in helping me, but the last couple of times I got no response, so I'm not going to bother unless I can get some help this time. Thanks.
1
0
408
Feb ’25
iOS 18: startRangingBeacons Stops When Display is Off in Background (Worked on iOS 17.2.1)
Issue Summary After calling startRangingBeacons, the didRangeBeacons delegate method does not receive iBeacon scan data when the device display is turned off in the background. Expected Behavior On iOS 17.2.1 (iPhone 14), beacon ranging continues in the background even when the display is turned off. The same behavior is expected on iOS 18, but it is not working as intended. Observed Behavior On iOS 18, once the display turns off, beacon ranging stops, and the didRangeBeacons method is not triggered until the display is turned back on. • Location permission is set to “Always Allow.” • Background Modes are correctly configured (Location Updates enabled). Steps to Reproduce Ensure location permission is set to Always Allow. Enable Background Modes → Location Updates in Xcode settings. Call startRangingBeacons(in:) in the app. Put the app in the background and turn off the display. Observe that didRangeBeacons is not triggered while the display is off. Additional Notes • The issue does not occur on iOS 17.2.1 (iPhone 14), where beacon ranging continues even with the display off. • This behavior change is observed on iOS 18 across multiple devices. Could you confirm if this is an intended change in behavior or a bug? If this is expected behavior, what alternative approach is recommended to maintain continuous beacon ranging when the display is off in the background?
2
0
426
Feb ’25