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

React-native-map. LongPress callback not working
Summary The onLongPress callback on MapViewcomponent is not working on iOS devices. The callback is properly implemented but never gets triggered on iOS, while it works as expected on Android. Reproducible sample code <MapView onLongPress={(e) => { console.log("onLongPress", e); setAddLocation(e.nativeEvent.coordinate); }} // ... other props Steps to reproduce Just put onLongPress callback on MapView and notice it won't be triggered. Expected result Long press on the map should trigger the onLongPress callback The callback should receive the event object with coordinates Actual result Long press on the map does not trigger the callback on iOS No console logs are shown when long pressing The functionality works as expected on Android React Native Maps Version 1.23.8 What platforms are you seeing the problem on? iOS (Apple Maps) React Native Version 0.79.2 What version of Expo are you using? SDK 53 Device(s) Any iOS Device
0
0
41
3w
Symbol not found: _$sSo22CLLocationCoordinate2DVSE12CoreLocationMc when building for visionOS 2.5 with Xcode 16.3
Hello, I'm encountering a runtime crash when building my visionOS app with Xcode 16.3 for visionOS 2.5. Our existing AppStore/Testflight app is also instantly crashing on visionOS 2.5 when opened but works fine on e.g visionOS 2.4. The app builds successfully but crashes on launch with this symbol lookup error (slightly adjusted because the forum complained regarding sensitive data): Symbol not found: _$sSo22CLLocationCoordinate2DVSE12CoreLocationMc Referenced from: <XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX> /private/var/containers/Bundle/Application/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/MyApp.app/MyApp.debug.dylib Expected in: <XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX> /usr/lib/swift/libswiftCoreLocation.dylib dyld config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/usr/lib/libLogRedirect.dylib:/usr/lib/libBacktraceRecording.dylib:/usr/lib/libMainThreadChecker.dylib:/System/Library/PrivateFrameworks/GPUToolsCapture.framework/GPUToolsCapture:/usr/lib/libViewDebuggerSupport.dylib I've already implemented my own Codable conformance for CLLocationCoordinate2D: extension CLLocationCoordinate2D: Codable { // implementation details... } This worked fine on previous visionOS/Xcode versions. Has anyone encountered this issue or found a solution? System details: macOS version: 15.3.2 Xcode version: 16.3 visionOS target: 2.5 Thank you!
2
0
57
May ’25
Request of CarPlay Navigation Entitlement when having the Driving Task one
I have the CarPlay Entitlement "Driving Task" and two of my apps use it. Now, in both apps, I have implemented Navigation. I requested the Navigation CarPlay Entitlement when the feature was mature and builds were available in Test Flight, since I wanted to release the new versions of the apps with navigation available both on the iPhone and in CarPlay. I got no answer to my request, so I decided to release the apps with only navigation in the iPhone and the Driving Task functionality in CarPlay, thinking that maybe being live with navigation in the App Store was a requirement. I have asked permission again, and so far, the request is being ignored again. What are the requirements to get the Navigation CarPlay Entitlement? If the app is approved for navigation, is there something else the app must do to get the entitlement? Requirements for CarPlay Entitlements seem quite obscure, are they listed anywhere? Is there a technical problem to move from an existing CarPlay Entitlement to another? Can that be the reason the entitlement has not been granted? Some of my competitors have the CarPlay Navigation entitlement. My use case is the same (in a better app in my opinion, of course). But I am only getting bad reviews because "the app does not include the map in CarPlay" after the big investment in implementing navigation in the apps. Any help or insight would be appreciated.
2
0
754
May ’25
CLLocationUpdates stops when user sleeps
I am using CLLocationUpdate.liveUpdates() to build a location sharing app. Most of the time it works fine, including in the background, giving acceptably frequent updates. However, soon after the user puts their phone away for the night, the updates stop coming. I've checked all the instance properties (.stationary, .locationUnavailable, etc.) but none of them are ever set to true, even for the last update before updates end. Is there some way to keep the updates coming through the night? I've included some relevant parts of my code here: func startLocationUpdates() { if self.manager.authorizationStatus == .notDetermined { self.manager.requestWhenInUseAuthorization() } Task { do { self.background = CLBackgroundActivitySession() self.session = CLServiceSession(authorization: CLServiceSession.AuthorizationRequirement.always) let updates = CLLocationUpdate.liveUpdates() for try await update in updates { if let loc = update.location { BackgroundServiceKt.onLocationUpdate(arg: loc) } // check all the instance properties } } catch { // error } return } } class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { LocationsHandler.shared.startLocationUpdates() return true } }
0
0
69
May ’25
Apple Maps URL scheme daddr=lat,long no longer working – regression?
Hello, I'm experiencing an issue with the Apple Maps URL scheme when using raw latitude and longitude coordinates in the daddr parameter. Until recently, using a URL like this worked reliably: https://maps.apple.com/?daddr=37.7749,-122.4194 This would open Apple Maps and show directions from the current location to the specified coordinates. However, on recent iOS versions, this URL no longer behaves as expected.
1
0
56
May ’25
[iOS] Location data no longer updating consistently after updating the app from old version
I am developing an iOS app that uses CLLocationManager to collect location continuously in both foreground and background. But it has the following 4 issues and I don’t understand why: After a while of not using the app, I can not get location updates regularly. Even after that, I go into the app more often or even turn OFF and turn ON the permission again, but the problem still doesn’t improve until I reinstall the app. Previously, I used SilentLog SDK to collect location. Since the cost was quite high, we developed our own SDK that also handles location tracking. After updating the app from the old version using SilentLog SDK to the new version using my own SDK, I can not get location updates regularly. However, when I reinstalled the app, it worked perfectly. It seems that apps downloaded from TestFlight can get location more continuously than apps downloaded from the App Store We sometimes encounter this error in the logs: Error Domain=kCLErrorDomain Code=0 “(null)” I think my app was not terminated in the background because I still collect location but it is not as frequent. I want to know if Apple has any mechanism to prevent such apps from getting location data continuously? I use CLLocationManager with the following configuration: self.locationManager.distanceFilter = 20 self.locationManager.desiredAccuracy = kCLLocationAccuracyBest self.locationManager.allowsBackgroundLocationUpdates = true self.locationManager.showsBackgroundLocationIndicator = false self.locationManager.pausesLocationUpdatesAutomatically = false I also filter the location updates using: guard let location = locations.last else { return } guard location.horizontalAccuracy <= 100 else { return } guard location.speedAccuracy >= 0 else { return } I use a background task to wake up the device every 15 minutes, and I also use silent push notifications in a similar manner. Each time the task is executed, I usually call stopLocation and then startLocation again. This happens quite frequently — will it have any impact or cause any issues?
0
0
71
May ’25
kCLErrorLocationUnknown becoming a big issue
In the last few months we have seen a lot of the following errors in which it fails to retrieve location information. This seems to happen across multiple browsers and feels related to apple/mac OS more than the browsers. Error: "CoreLocationProvider: CoreLocation framework reported a kCLErrorLocationUnknown failure." Any suggestions or an ETA on when this can be fixed? I have seen other threads/posts on this but wanted a new one to highlight the issue is prevalent.
2
0
356
May ’25
Background location indicator stuck in dynamic island when using CLServiceSession and CLBackgroundActivitySession
We have a setup that's really close to the one used in the example project - Monitoring location changes with Core Location. In short, we have a flag that indicates whether or not we should start background location monitoring. If the flag is on, after the app starts, we Create a CLServiceSession with authorization: .always Create a CLBackgroundActivitySession The user can perform an action (press a button) to toggle the flag off, in which case we invalidate and dispose of the CLServiceSession and CLBackgroundActivitySession instances and cancel any liveUpdates observation. So far, so good, everything works as expected. However, we're experiencing a weird behavior on iPhones with Dynamic Island after there's an app update. When the user is on the same app version, the behavior is correct. have the flag on, background location monitoring works fine, when the app is in the the background, there's correctly a location indicator in Dynamic Island the user can go back to the app and turn the flag off (disposing of instances, cancelling location observation), and when the app is in the background, there is no location indicator in Dynamic Island The problem arises when the user updates the app open version 1.0 of the app have the flag on, background location monitoring works fine, when the app is in the the background, there's correctly a location indicator in Dynamic Island download an app update - version 2.0 the app restarts, didFinishLaunchingWithOptions gets called again and we start the background services dynamic island indicator is correctly showing a location indicator the user goes into the app, toggles the flag off - turning location observation off, we dispose of everything now, when the app is moved to the background, there's still a location indicator in the Dynamic Island, even though we're no longer observing location The indicator is hard to get rid of, there are only 2 ways we've found restart the device, or uninstall the app The question is - is this a bug in the system? Or is there anything we should be doing actively after an app update? Thank you!
1
1
59
May ’25
Polyline rendering below street labels in MapKitJS
Hello (: I’m working with MapKitJS and would like to render polylines that follow roads — similar to the behavior seen on maps.apple.com. While I can align polylines to roads manually, I haven’t found a way to render them below street names and road shields. Currently, all polylines appear above labels, which reduces readability when displaying routes in urban areas. On maps.apple.com, polylines are rendered under street labels, which provides a much cleaner appearance. Is there a way to achieve this layering behavior in MapKitJS? If not, are there plans to support this kind of layer control in the future? Thanks in advance! MapKitJS (5.45.0): maps.apple.com:
2
0
48
May ’25
How can I prevent virtual location from affecting the security of my app
Hello, I have noticed that some users have modified their real location through an app called "MGU" to bypass my app's security checks. I want to know how to protect my app and detect users using virtual location. I have reproduced the process of virtual positioning here: Insert a plug-in through the interface at the bottom of the phone and connect it via Bluetooth on the phone Set the desired positioning target on the "MGU" app Turn off your phone's WiFi, network, and location for 10 seconds, then turn it back on At this point, virtual positioning is successful. Please assist me in troubleshooting this issue and inform me of the principle of implementing virtual positioning in this app and how to prevent it. The following is the screen recording of virtual positioning operation: https://flowus.cn/share/145b3232-26c3-4ea3-b3ff-4aad1495eb4d
1
0
54
Apr ’25
MapKitJS Pricing
Hello (: I have a question regarding the current pricing model for Apple Maps APIs, specifically MapKitJS, the Maps Snapshot API, and the Maps Server API. Previously, the documentation and my understanding indicated that the usage limits were defined per day — for example, 250,000 map loads per day for MapKitJS and 25,000 snapshots per day. However, in the Apple Developer Dashboard, I’m now seeing these limits shown on a per-month basis, such as only 25,000 snapshots per-month. This appears to contradict the publicly available information on the official website, which still states daily limits. Has the pricing model officially changed, or is this just a display issue in the dashboard? I need to know this because we're going into release soon, and then we might have thousands of users.
2
1
70
Apr ’25
[MapKit] Initialization failed because the authorization token is invalid.
When I try to import mapkitjs using HTML, I use the correct token, but the error token is invalid. <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>地点信息查询</title> <style> body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; margin: 0; padding: 20px; background-color: #f5f5f7; } .container { max-width: 800px; margin: 0 auto; } .search-box { width: 100%; padding: 10px; margin-bottom: 20px; border: 1px solid #ccc; border-radius: 8px; font-size: 16px; } .result-container { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); } .place-image { width: 100%; max-height: 300px; object-fit: cover; border-radius: 8px; margin-bottom: 15px; } .place-info { margin-top: 15px; } .place-info h2 { margin-top: 0; color: #1d1d1f; } .info-item { margin: 10px 0; color: #515154; } #map { width: 100%; height: 300px; border-radius: 8px; margin-top: 20px; } </style> </head> <body> <div class="container"> <h1>地点信息查询</h1> <input type="text" id="searchInput" class="search-box" placeholder="请输入地点名称(如:北京故宫)"> <div class="result-container"> <div id="placeImage"></div> <div class="place-info"> <h2 id="placeName"></h2> <div id="placeDetails"></div> </div> <div id="map"></div> </div> </div> <script src="https://cdn.apple-mapkit.com/mk/5.x.x/mapkit.js"></script> <script> // 初始化 MapKit mapkit.init({ authorizationCallback: function(done) { done('mytoken'); }, language: 'zh-CN', region: 'CN', callback: function(error) { if (error) { console.error('MapKit 初始化错误:', error); alert('地图服务初始化失败,请检查网络连接和授权设置'); } else { console.log('MapKit 初始化成功'); } } }); // 添加错误处理 window.addEventListener('error', function(event) { console.error('MapKit 错误:', event.error); }); const searchInput = document.getElementById('searchInput'); const placeImage = document.getElementById('placeImage'); const placeName = document.getElementById('placeName'); const placeDetails = document.getElementById('placeDetails'); const mapDiv = document.getElementById('map'); let map; searchInput.addEventListener('input', debounce(searchPlace, 500)); function debounce(func, wait) { let timeout; return function executedFunction(...args) { const later = () => { clearTimeout(timeout); func(...args); }; clearTimeout(timeout); timeout = setTimeout(later, wait); }; } async function searchPlace() { console.log('搜索'); const query = searchInput.value; if (!query) return; try { // 使用 MapKit 搜索地点 const search = new mapkit.Search({ region: new mapkit.CoordinateRegion( new mapkit.Coordinate(39.9042, 116.4074), // 默认北京坐标 new mapkit.CoordinateSpan(0.1, 0.1) ) }); search.search(query, (error, data) => { if (error) { console.error('搜索错误:', error); return; } if (data.places.length > 0) { const place = data.places[0]; displayPlaceInfo(place); showMap(place); } }); } catch (error) { console.error('获取地点信息失败:', error); } } function displayPlaceInfo(place) { placeName.textContent = place.name; let detailsHTML = ''; if (place.address) { detailsHTML += `<p class="info-item">地址: ${place.address}</p>`; } if (place.phoneNumber) { detailsHTML += `<p class="info-item">电话: ${place.phoneNumber}</p>`; } if (place.url) { detailsHTML += `<p class="info-item">网址: <a href="${place.url}" target="_blank">${place.url}</a></p>`; } placeDetails.innerHTML = detailsHTML; // 获取地点图片 if (place.pointOfInterestCategory) { // 这里可以调用其他图片API来获取地点图片 // 示例使用占位图片 placeImage.innerHTML = `<img src="https://source.unsplash.com/800x400/?${encodeURIComponent(place.name)}" class="place-image" alt="${place.name}">`; } } function showMap(place) { if (map) { map.remove(); } map = new mapkit.Map(mapDiv, { region: new mapkit.CoordinateRegion( place.coordinate, new mapkit.CoordinateSpan(0.01, 0.01) ) }); const annotation = new mapkit.MarkerAnnotation(place.coordinate, { title: place.name, data: { place: place } }); map.addAnnotation(annotation); } </script> </body> </html>
1
0
14
Apr ’25
GPS HDOP
I have a marine navigation app which displays GPS quality information when receiving NMEA message from an external GPS. These include the number of satellites and Horizontal Dilution of Precision (HDOP). As far as I can see, the only additional information available through location services (for devices with built in GPS) is horizontal and vertical accuracy. Am I missing anything? Also does anyone know how horizontal accuracy is derived from HDOP?
0
0
24
Apr ’25
[CoreLocation][iOS 18.3.2] OS is not notifying monitored region state to application
We have an application. We are monitoring the fence event. We are using 'startMonitoringForRegion' API. but we are not getting any fence event. Steps Create a fence using 'startMonitoringForRegion' API BG on APNS trigger. initial fence state 'didDetermineState' not received. From Syslogs we can see OS has detected but event is not given to Application We are compiling code using SDK18.0 Error ** locationd Fence: LAC monitoring is not sufficient for / ocationd Fence: no allowing wifi monitor for, 400.0, fence Feedback Ticket ID: FB17250308 Syslogs Snippet: debug 2025-04-15 12:45:40.890193 -0500 locationd FenceCal: combine non-fine non-large fence, distance, 0.0, / //OS detetected fence state default 2025-04-15 12:45:44.706232 -0500 locationd Fence: fenceUpdate, , bundle, , type, GPS , loc, 33.1171776, -96.6606076, acc, 19, distance, 17, tech, LC...+, trans, 0, state, 0, cont, 1, fence, 33.11728835, -96.66048288, 1011.0, 766431742.6, sCount, 0, 0, trig, 0, 3, sinceLastLoc, 10.0, events, 0x00001810, status, (Inside) => (Inside) , settled state, (Unknown) ==> (Unknown), cantShiftButNeedTo, 0, sinceLastTransition, -1.0, significant, 0, loi, 0, lastProximityStateTimestamp, -1.000000, lastProximityState, 0, lastApproachingState, 0 // debug 2025-04-15 12:45:44.706247 -0500 locationd Fence: LAC monitoring is not sufficient for / // debug 2025-04-15 12:45:44.706263 -0500 locationd Fence: no allowing wifi monitor for, 400.0, fence, Fence, []//, latitude, 33.11728835, longitude, -96.66048288, refFrame, 0, distance, 1011.0, eFistance, 1011.0, lDown, -1.0, time, 766431742.6, ctime, -1.0, flags, EX------, key, -1506186373, throttled, N, polygon, 0, envType, 2, locType, 0
1
0
55
Apr ’25
Core Location reports incorrect location update especially with underground travel
Description of the Bug: Core Location intermittently reports inaccurate location updates, albeit with a high accuracy value. This problem occurs almost exclusively while travelling in metros underground affecting the ability to rely on the framework effectively. Steps to Reproduce: The user starts travelling on ground level at point A The user continues travelling and, after some time, is now underground at point B. A stationary beacon scanned at point B confirms this. Core Location is observed to deliver a location update with a high-accuracy value but with the coordinates around point A when the user is actually around point B. Expected Behaviour: Accurate locations should be delivered at all times. In other words, Core Location should not report location updates with high accuracy when its certainty is low.
1
0
36
Apr ’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
34
Apr ’25
Unable to use altitude for our use case (NYC MTA)
We’re building a new subway/bus app at the MTA. Our system includes roughly 300 underground stations, around 150 elevated stations (i.e., above street level), and about 5 at-grade stations (i.e., at street level). We serve roughly 5 million riders a day. We’re diving deep into Core Location on iOS and have found that the altitude values returned from two fields we’re testing aren’t accurate enough for our use case: CLLocation.altitude CMAbsoluteAltitudeData.altitude We need to reliably distinguish whether a user is: At street level On an elevated platform (see attached picture) On any platform in an underground station — most have a single platform level, but some, like 59 St (see attached), have multiple platforms at different elevations. These levels typically differ by at least 15 feet, which should in theory be well within the precision range of a properly calibrated barometric pressure sensor. However, the absolute altitude values we’re seeing from these APIs are often inaccurate and inconsistent — not only compared to ground truth, but also across devices. For example, holding two phones side-by-side frequently yields altitude readings that differ by more than 15 feet. That level of variation makes the data unreliable for our needs. Please see the below photos for more context. URLs.md
8
0
95
Apr ’25
UIKit mapView color annotations
I have tried to make colored annotations in mapView (shown in the commented sections) but they always appear in black. Any help would be appreciated. func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { let annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "TempAnnotationView") annotationView.canShowCallout = true annotationView.rightCalloutAccessoryView = UIButton(type: .detailDisclosure) let configuration = UIImage.SymbolConfiguration(pointSize: 10, weight: .thin, scale: .default) if annotation.title == "Start" { // let config = UIImage.SymbolConfiguration.preferringMulticolor() // let image = UIImage(systemName: "flag.fill", withConfiguration: config) // // palette // let config2 = UIImage.SymbolConfiguration(paletteColors: [.systemRed, .systemGreen, .systemBlue]) // let image2 = UIImage(systemName: "person.3.sequence.fill", withConfiguration: config2) // // hierarchical symbols // let config3 = UIImage.SymbolConfiguration(hierarchicalColor: .systemIndigo) // let image3 = UIImage(systemName: "square.stack.3d.down.right.fill", withConfiguration: config3) // // color // let image4 = UIImage(systemName: "cone.fill")?.withTintColor(.systemRed, renderingMode: .alwaysTemplate) // annotationView.image = image4 annotationView.image = UIImage(systemName: "poweron", withConfiguration: configuration) } return annotationView }
3
0
681
Apr ’25