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

Horizontal and Vertical Accuracy for CoreLocation
We’re implementing a feature in our app that allows a certified MFi GPS device to act as the default location source for user positioning, replacing the internal GPS when connected. However, we’re noticing a significant discrepancy between the accuracy values reported by iOS and those directly available from the GPS device. Here’s the issue: When the MFi GPS is in use, it transmits standard NMEA messages (GGA, GSA, RMC, etc.) to the iOS device (providing HDOP and VDOP). However, the accuracy reported by iOS for this “location-system” seems to be less precise than what the GPS device itself reports. For example, here are the readings we observe: Location from iOS device (systemLocation): Position: <+41.4, +1.8> +/- 5.00m (speed 0.05 m/s / course 329.40) Timestamp: 6/11/24, 12:01:50 Central European Standard Time Horizontal Accuracy (from systemLocation): 5.0 meters (16 ft) Vertical Accuracy (from systemLocation): 9.5 meters (31 ft) Location from GPS device directly: Horizontal Accuracy: 9.1 ft Vertical Accuracy: 10.3 ft It’s evident that the accuracy values displayed by iOS differ from the values available from the GPS device, especially in terms of horizontal and vertical accuracy. Question: Is there a known reason for this discrepancy in accuracy values? Is there a way to obtain the GPS device’s native accuracy values in iOS, or is iOS applying additional filtering or adjustments that might explain this difference? If additional filtering is applied can be disabled? Any insights would be greatly appreciated, as accurate location reporting is critical for our app’s functionality.
1
0
631
Nov ’24
Do I need to maintain CLServiceSession when app relaunches from terminated state due to CLMonitor events?
I'm currently testing the CLMonitor API and have a question about CLServiceSession management. When my app is relaunched from a terminated state in the background due to CLMonitor events, do I still need to create and maintain a CLServiceSession instance? I'm wondering if CLServiceSession is necessary even when I don't need to continuously receive GPS updates through liveUpdates. Since CLMonitor can trigger app launches for region monitoring events without requiring constant location updates, I'm unclear about whether the CLServiceSession is still required in this scenario. Any clarification on the proper implementation would be greatly appreciated. Thanks!
1
0
145
4w
Country from MKReverseGeocoding
As GeoCoder is now deprecated I am struggling to get the country only information from the new MKReverseGeocoding. Maybe someone can guide me or give me direction? Or is this just not possible anymore? let request = MKReverseGeocodingRequest(location: self.lastLocation ?? fallbackLocation) request?.getMapItems { items, error in guard let items = items else { return } self.cityName = items.first?.addressRepresentations?.cityWithContext ?? "" self.countryName = items.first?.addressRepresentations?.regionName ?? "" } I couldn't find anything here, sure you can get the full Address but I need single values to store so the user can search for (example City, Country) In case the structure is always the same, let us say the country is always third part, sure I could split the string but it is not a reliable way to do this, at least for me. Any help would be much appreciated.
1
0
90
3w
Location Error
I started getting a location error recently. I've never seen this error before and it began happeing randomly. Here is the breakpoint. (if let locationManager........) var currentLocation: Result<CLLocation, Error> { get { #if DEBUG return .success(CLLocation(latitude: CLLocationDegrees(exactly: 0)!, longitude: CLLocationDegrees(exactly: 0)!)) #else if let locationManager = self.locationManager { return locationManager.currentLocation } return .failure(LocationError.unknown) #endif } } I've tried everything I can think of to fix the issue. It has an issue getting the users location when logging in. I've made no changes to the code and everything has worked for years. The bug reports show nothing. I've tried re-installing Xcode, rebuilding the pods etc. I've tried everything that you would normally do in this situation.
1
0
443
Nov ’24
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
375
Feb ’25
Zspeedaccuracy question
Hello everyone, I'm doing some work on validating some data to do with the zpseed functionality around corelocations, i've read up on the speedaccuracy field but the wording doesn't make sense to me. It says if its a positive number it is plus or minus the value in the zspeed column so would this be for example zspeed of 35 mps with an accuracy of 3 mps would it be 32 mps 38 mps or is it a range? so would it be anywhere between 32-38 mps. Or is it just plus or minus the 3mps and if this is the case how would it be worked out if its plus or minus when all the numbers will be a positive numbers as any negative numbers are deemed inaccurate ?
1
0
54
Apr ’25
How to open Enhanced Apple Maps page from iOS app
I'm trying to create a link from a restaurant annotation on a map in my app (created using MapKit) that will open the Apple Maps app on an iphone. I've been using the Restaurant name, telephone number, and coordinates and cannot get applemaps to open the enhanced page (which contains photographs and customer reviews and is much more descriptive than the page that is opening, which only shows the location on a map with the phone number and coordinates. It is not that descriptive, and I'm trying to create a request that will make it very easy to jump back and forth between my app and the enhanced page on apple maps. here's what I'm using in my request: " private func openInAppleMaps() { let coordinate = CLLocationCoordinate2D(latitude: restaurant.latitude, longitude: restaurant.longitude) let placemark = MKPlacemark(coordinate: coordinate) let mapItem = MKMapItem(placemark: placemark) mapItem.name = restaurant.name if let phone = restaurant.telephone1 { mapItem.phoneNumber = phone } mapItem.openInMaps(launchOptions: [MKLaunchOptionsShowsTrafficKey: true]) } }" the entire file is attached. Any help or advice would be much appreciated. RestaurantCallOutBox.swift
1
0
414
Dec ’24
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
350
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
390
Feb ’25
Bachelor Thesis -Geolocation
Hello, I write a Bachelor-Theses about Geolocation on an iPhone. I have a Signal-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 signal 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
313
Feb ’25
How the duck can I use .p8 to get the Mapkit Server API token to use it without 7 day duration?
https://developer.apple.com/documentation/applemapsserverapi/creating-and-using-tokens-with-maps-server-api This doesn't really say what to do with .p8 private key. I know I am a noob but I really don't understand Apple Doc at all. There is no example or anything like that. const appleMapKit = await fetch("https://maps-api.apple.com/v1/token", { headers: { Authorization: `Bearer ${server_api_token}`, }, }); This is what I did but because I created the token on website, server_api_token only lasts 7 days. So, I tried to use Profile - Key to replace that. I have .p8 file and how can I use this to create the token for the server api?
1
0
588
Nov ’24
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
261
Mar ’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
431
Feb ’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
256
Feb ’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
253
Mar ’25