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

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
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
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
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
CLLocation liveUpdate Not Working After App Resurrects in Background
According to WWDC sessions, the recommended approach for continuing location collection in the background with liveUpdate is by using CLBackgroundActivitySession. In the app I’m currently developing, I call the invalidate function on the backgroundActivitySession instance when the app enters a terminated state. Then, when the app is resurrected due to startMonitoringSignificantLocationChanges, it reinitializes liveUpdate to resume location collection. When initializing CLBackgroundActivitySession, I also reinitialize the liveUpdates object to ensure the CLLocation.Updates instance is refreshed. However, regardless of the order in which I refresh these two instances, location collection does not resume when the app is revived in the background. Should the originally created CLBackgroundActivitySession instance never be invalidated? Any guidance on whether I am implementing this correctly would be greatly appreciated.
1
0
644
Nov ’24
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
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
Maps Web Snapshots: 500 Internal Server Error
Currently (at least for a few days, maybe longer), when trying to create an Apple Maps Web Snapshot according to https://developer.apple.com/documentation/snapshots/generating_a_url_and_signature_to_create_a_maps_web_snapshot with a custom image marker (passed as Base64 PNG), the Apple server responds with a 500 Internal Server Error. Using the default balloon marker works, but a custom Base64 image marker used to work in the past (and still should according to the documentation).
1
1
192
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
GPS Icon Appears on App Launch Despite No CLLocationManager Usage – Need Help Tracing Cause
Hello everyone, I’m facing an issue with my iOS app where the GPS/location services icon appears in the status bar immediately when the app is launched, even though I’m not intentionally accessing location services at that point. Issue Summary: • GPS Icon Activation: When I launch my app, the GPS icon turns on. It turns off when the app is minimized or closed. • No Intentional Location Usage at Launch: I have ensured that no instances of CLLocationManager are created when the app is launched. What I’ve Tried So Far: 1. Checked Controllers and Related Classes: • Reviewed all the code for the controllers that are active at launch. • Verified that none of these controllers create instances of CLLocationManager or call location-related methods. 2. Commented Out startUpdatingLocation: • Commented out all calls to startUpdatingLocation throughout the entire project. 3. Ensured No CLLocationManager Instances at Launch: • Searched for any code that might instantiate CLLocationManager during app launch. • Confirmed that no such instances are being created. 4. Commented Out Google Maps SDK Configuration: • In AppDelegate, commented out the Google Maps SDK configuration, so it’s not initialized with the API key. • No map views (GMSMapView, MKMapView) are initialized or used when the app is launched. 5. Tested Location Permissions: • When I change the location permission for the app to “Never” in the Settings app, the GPS icon does not appear upon app launch. • This suggests that the app is accessing location services when it has permission, even though I haven’t explicitly requested it at launch. Objective: • Control GPS Activation: I want to ensure that the GPS does not turn on when the app is launched. I intend to activate location services only when needed later in the app. Request for Assistance: I’m seeking guidance on the following: 1. Debugging Techniques: • How can I trace the code that’s causing the GPS to turn on at app launch? • Are there tools or methods to identify hidden or indirect calls to location services? 2. Forcing Location Services Off at Launch: • Is there a way to programmatically prevent location services from activating during app launch? • Can I defer any implicit location service initialization until I explicitly enable it? 3. Potential Hidden Triggers: • Are there known scenarios where location services could be activated without direct use of CLLocationManager? • Could frameworks like Google Maps SDK trigger location services even if not fully initialized? 4. Additional Suggestions: • Any other insights or suggestions to prevent the GPS icon from appearing on app launch. Additional Information: • Third-Party Frameworks: • I have not removed third-party frameworks yet, as I wanted to check other possibilities first. • Open to the idea that a third-party framework might be causing this, but need guidance on how to confirm. • Code Availability: • I’m happy to provide specific code snippets if that would help diagnose the issue. Environment: • Xcode Version: Xcode 15.4, Xcode 16.0 • iOS Deployment Target: iOS 15.0 • Devices Tested: iPhone SE 2nd and 3rd gen, iPhone 15, iPhone 15 pro, iPhone 11 • Programming Language: Swift What I’m Looking For: • Assistance in tracing the cause of the GPS activation on app launch. • Suggestions on how to prevent location services from starting until explicitly needed. • Insights into any hidden triggers or indirect usages that might cause this behavior. Thank you for your time and assistance. Any help to resolve this issue would be greatly appreciated.
1
1
413
Oct ’24