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

Post

Replies

Boosts

Views

Activity

Expected behavior of CLServiceSessions(.always) after device restart?
Hi! I was wondering what the expected behavior of CLServiceSession(authorization: .always) after a device restart was? What I am observing right now is that, after a device restart, location access from the background is denied until the app enters the foreground for the first time (CLServiceSession.Diagnostic says insufficientlyInUse: true; CLLocationUpdate additionally says serviceSessionRequired: true). Is this the expected behavior? If it is, then this seems like a somewhat suboptimal user experience to me, at least for my use case - the user's intention regarding the background location access won't have changed just because the device was rebooted. (In case this is relevant, my use case is transmitting the current location to connected Bluetooth devices, e.g. digital cameras. As such my app is setting UIBackgroundModes of ["bluetooth-central”]).
0
0
17
8h
MapKit .standard doesn't allow for globe view when zoomed out
Hi, I'm writing because I've been trying to set the .standard map style to render as a globe on an iPhone 15 running iOS 17 when zoomed out similar to how it works in Apple Maps but can't find any resources on how to make that happen as every time it appears as a flat 2D map, much unlike the .hybrid and .satellite types. I found another thread on this forum a year ago where someone said .standard was bugged and couldn't become a globe, but I'm honestly quite surprised this issue hasn't been brought up more often.
2
0
81
19h
Guideline 5.1.2 - Legal - Privacy - Data Use and Sharing
The app privacy information provided in App Store Connect indicates the app collects data in order to track the user, including Precise Location. However, the app does not use App Tracking Transparency to request the user's permission before tracking their activity. Apps need to receive the user’s permission through the AppTrackingTransparency framework before collecting data used to track them. This requirement protects the privacy of users. ---How do I fix this problem? I've submitted my app and in return they provided a screenshot of it clearly asking for permission before the app even loads the map in the background. Even though in the screenshot it's asking them for permission they are telling me it's not prompting the user before it starts tracking. I'm lost, help.
0
0
66
2d
Location interval on the iOS platform, with Flutter's Geolocator
Hey guys. I'm building a cross-platform app using Flutter, which uses the Geolocator package to see how far the user has travelled from their starting point, aviation related. I do allow the user to select their own distance filter value from a set of pre-defined options, which could be as low as a metre, since the app is designed for use over relatively small distances, from say 200m to 1km. Therefore, having a large distance filter value wouldn't make much sense. However, the issue I am having is that with iOS, I can't seem to control the actual sample rate of the user's location. From what I gather, iOS measures the user's location approximately once every second, give or take a bit, but that value cannot be changed. That's quite different to Android, where I can specify this measurement interval to be whatever I want it to be. This lack of ability to control the measurement interval tends to cause quite a lag. When someone first starts to move, they aren't travelling fast enough to cause a noticeable lag. However, when someone's speed picks up, they could be travelling at around 70mph/32m/s (ish). If you're only measuring the user's location once every second, then it's likely they will have travelled over 30m before the next location update, which means the lag distance could potentially be huge relative to the maximum distance they will measure using the app. I do fully appreciate that this is native functionality to iOS but my question really is, is there perhaps a way around this? Is there any way to increase the frequency with which the user's location is retrieved, so that I can reduce this lag? If there isn't, that's no problem at all. I just thought I would ask the question, incase someone has come across this before and found a solution that works. These are the Apple-related settings that I have been able to control with Flutter, for the Geolocator package. Thank you in advance! locationSettings = AppleSettings( accuracy: LocationAccuracy.bestForNavigation, activityType: ActivityType.otherNavigation, distanceFilter: distanceFilterValue, pauseLocationUpdatesAutomatically: false, showBackgroundLocationIndicator: false, );
2
0
63
3d
Getting "locationUnknown" as error code in Core Location delegation method didFailWithError for iOS v17.5 and v17.5.1
We have been observing a major spike in Core Location delegation method didFailWithError for iOS v17.5 and v17.5.1. Sharing the implementation of the code at our end - func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { if let clError = error as? CLError { switch clError.code { case .locationUnknown: print("Location unknown") case .denied: print("Access denied") case .network: print("Network error") default: print("Other error: (clError.code)") } } else { print("Other error: (error.localizedDescription)") } } We are observing error responses with error code 0: locationUnknown in iOS 17.5 and above. Is anyone else facing the same issue? Not able to debug this at our end.
1
0
140
1w
Siri can directly launch Map App for navigation
DESCRIPTION OF PROBLEM We discovered that Siri can directly launch Amap and Tencent Maps for navigation. Our app also wants to integrate this feature. After our research, we found that AppIntents cannot accomplish this functionality. Because the parameters of AppIntents are limited. How can we achieve this? Do we need to apply for certain permissions from Apple? STEPS TO REPRODUCE awake siri say "使用高德地图打车去南京南站"
4
0
129
1w
Crash when CLLocationUpdate.liveUpdates is called while requesting authorization by CLServiceSession
I watched this video and programmed with this sample code as a reference. The application crashed when I toggled the switch with the following code. // // ContentView.swift // LiveUpdatesInCoreLocation // import os import SwiftUI import CoreLocation @MainActor final class ContentViewModel: ObservableObject { private let logger = Logger() @Published var updatesStarted: Bool = false { didSet { updatesStarted ? self.startLocationUpdates() : self.stopLocationUpdates() } } func startLocationUpdates() { Task { let _ = CLServiceSession(authorization: .whenInUse) for try await update in CLLocationUpdate.liveUpdates() { guard self.updatesStarted else { break } logger.debug("update location: \(update.location)") } } } func stopLocationUpdates() {} } struct ContentView: View { @StateObject private var model = ContentViewModel() var body: some View { VStack { Toggle("Location Updates", isOn: $model.updatesStarted) } .padding() } } And this is the error that occurred. Thread 8: EXC_BAD_ACCESS (code=1, address=0x10) A bad access to memory terminated the process. If you remove the below code, the error will not occur. let _ = CLServiceSession(authorization: .whenInUse) Therefore, I guess that the problem is in calling CLLocationUpdate.liveUpdates while CLServiceSession is requesting authorization. or am I doing something wrong?
1
0
125
1w
Find My shows gibberish for city/region etc. in eastern europe
When viewing relatives' in Find My back in Europe (Slovenia, Croatia, Serbia) their location shows as some nonsense like " , 18" rather than the town, region, or country they're in. This used to work, but stopped a couple of years ago. I've opened a couple of Feedback tickets over the last couple of years, but they've seen zero activity and after numerous iOS and macOS updates, there's been no improvement in the behavior, so it's been recommended to me that I point out the question here. Here are the links: https://feedbackassistant.apple.com/feedback/12159041 https://feedbackassistant.apple.com/feedback/13500852 Is anyone else seeing this sort of behavior?
5
1
217
1w
pointOfInterestCategory missing on mapkit js placeLookup
const lookup = new mapkit.PlaceLookup() lookup.getPlace(input?.id, (error, place) => { console.log("place", place) ... gives me for example { "id": "I65A54A72CE9E45D6", "alternateIds": [ "IB86C41DA005E0D9B" ], "muid": "7324342225941186006", "_styleAttributes": "4:226,6:16,10:0,82:12,85:12,89:1,164:1,193:1", "name": "The Museum of Modern Art", "region": { "center": { "latitude": 40.7612829, "longitude": -73.9768677 }, "span": { "latitudeDelta": 0.008983199999995861, "longitudeDelta": 0.01186000000001286 } }, "coordinate": { "latitude": 40.7617238, "longitude": -73.9777654 }, "formattedAddress": "11 W 53rd St, New York, NY 10019, United States", "countryCode": "US", "telephone": "+12127089400", "urls": [ "http://www.moma.org" ], "country": "United States", "administrativeArea": "New York", "administrativeAreaCode": "NY", "locality": "New York", "postCode": "10019", "subLocality": "Manhattan", "thoroughfare": "W 53rd St", "subThoroughfare": "11", "fullThoroughfare": "11 W 53rd St", "areasOfInterest": [ "Manhattan" ], "dependentLocalities": [ "Midtown Center", "Midtown East", "Midtown Manhattan", "Midtown", "North Hudson" ], "timezone": "America/New_York", "timezoneSecondsFromGmt": -14400 } Note there is no pointOfInterestCategory. but const place_search = new mapkit.Search() place_search.search( input, (error, result) => { console.log("result_places_0", result?.places?.[0]) ... i get { "id": "I65A54A72CE9E45D6", "alternateIds": [ "IB86C41DA005E0D9B" ], "muid": "7324342225941186006", "_wpURL": "https://maps.apple.com/place?q=The%20Museum%20of%20Modern%20Art&auid=7324342225941186006&address=11%20W%2053rd%20St,%20New%20York,%20NY%20%2010019,%20United%20States&ll=40.7617238,-73.9777654", "_styleAttributes": "4:226,6:16,10:0,82:12,85:12,89:1,164:1,193:1", "pointOfInterestCategory": "Museum", "name": "The Museum of Modern Art", "region": { "center": { "latitude": 40.7612829, "longitude": -73.9768677 }, "span": { "latitudeDelta": 0.008983199999995861, "longitudeDelta": 0.01186000000001286 } }, "coordinate": { "latitude": 40.7617238, "longitude": -73.9777654 }, "formattedAddress": "11 W 53rd St, New York, NY 10019, United States", "countryCode": "US", "telephone": "+12127089400", "urls": [ "http://www.moma.org" ], "country": "United States", "administrativeArea": "New York", "administrativeAreaCode": "NY", "locality": "New York", "postCode": "10019", "subLocality": "Manhattan", "thoroughfare": "W 53rd St", "subThoroughfare": "11", "fullThoroughfare": "11 W 53rd St", "areasOfInterest": [ "Manhattan" ], "dependentLocalities": [ "Midtown Center", "Midtown East", "Midtown Manhattan", "Midtown", "North Hudson" ], "timezone": "America/New_York", "timezoneSecondsFromGmt": -14400 } which gives me "pointOfInterestCategory": "Museum" I think pointOfInterestCategory should also be returned in the placeLookup and might be a mapkit error that its not it would also be cool if search autocomplete gave me the poi so i could tag the search result previews (mapbox does this). Unrelated from this topic but coming from mapbox where everything had a mapbox_id i feel like some things like localities like "columbus, Ohio" should still have a place id but maybe the muid serves that purpose idk and just something i should account for. Lastly on my mind is how to manage rate limiting since im just giving the same mapbox js token to all the clients. Of course for server api I can manage my own system for rate limiting logged in users a bit easier but not sure about mapkit js though I can only dream my project is big enough i need to even worry about that lol.
1
0
186
2w
Location in the Background constant popups
We have a pair of apps that are used to monitor the location of a person and allow them to reach out for help when needed. The apps are designed to be used with persons with special needs. A large portion of our target audience is people that have cognitive disabilities. One app is used by people that monitor and help the person with needs, and the other is used by the person with needs who is not with them all the time. The issue we have is that our users have trouble understanding what to do when this verification popup appears. This popup continues to appear over and over and over. This is a severe health and safety issue for us. We find that the user is often times confused by the popup and is disabling the background location tracking preventing the needs provider from being able to track the location of the user. It would be great if there was a special Entitlement that could be granted that would prevent this 'feature' of iOS. Or possibly simply a setting that the user's provider can setup on their phone to stop the annoying and dangerous constant popups. If anybody knows of a way to prevent this popup, please let us know. Otherwise, if someone at Apple could suggest how we can make this happen in the future.
3
0
205
2w
MKMapview overlay renderding performance issue on iOS16
Hi , I have following scenario where I feel performance issue. Use-case: I have multiple Overlays(MKOverlay) rendered on MapView, and overlay needs to refresh on point Drag(MKPinAnnotation). I have custom logic to handle drag behaviour of annotation, on annotation drag I do update the overlay. As point update, I create new overlay with updated coordinate and re-render it. iT slow down the performance after few overlay added. Additional Notes: Performance was quite good on iOS16 but on iOS17, it lags the perforce on point drag. When I say it the performance, it point drag lags so it slow the overlay rendering. I am using MKMapView inside SwiftUI. I am sharing code-snippet where it re-render the overlay. Please help with issue in my code implementation. func renderSegments(mapView: MKMapView, segmentPoint: FencePointAnnotation, renderNeeded: Bool = true) { mapViewModel.updateFencePointOrder() guard let activeLayer = mapViewModel.activeLayer else { debugPrint("Invalid active layer.") return } let segments = mapViewModel.activeFence.connectedSegmentsOf(vertex: segmentPoint) // Remove existing overlay. for overlay in mapView.overlays { if let overlay = overlay as? FenceOverlay { if overlay.layerId == activeLayer.layerId { mapView.removeOverlay(overlay) } } else if let overlay = overlay as? FenceSegmentPolyline { if overlay.layerId == activeLayer.layerId { for segment in segments.values where segment.identifier == overlay.identifier { mapView.removeOverlay(overlay) } } } } // When vertex removed the no need to add segment if renderNeeded { if let segments = mapViewModel.updatedSegements(segment: segments.map({$0.key})) { let updatedSegments = mapView.updatedSegmentsWithOffset(segments: segments, layer: activeLayer) mapView.addOverlays(updatedSegments) } } }
5
1
154
2w
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.
0
0
179
2w
GPS problem with non moving iphone. Does Apple consider us users as totally infantile?
I had a problem that when traveling by boat the GPS dropped working for the boating app after a few seconds. Then I discovered that when picking up the iphone, the GPS information, that was read by the boating app, returned. At first I had the idea that the GPS signals were weak and my body fluids worked as a kind of extra antenna. But then by accident I noticed that the GPS signal returned when there were some waves that caused the boat to move extra. And so it turns out that Apple has apparently built in a security risk feature that when the iphone is not moving (apart from the very slow movement of the boat) it switches GPS off. Probably is this to protect us from being tracked in some way. An adult approach would leave it to the user to decide if this is a risk the user wants to take (so introduce a setting to turn off this security measure). But not so at Apple. I am getting very tired of trying to find ways to get around the unspecified safety measures that are not under control by me, the user. This is NOT a small minor problem. The app that I use is the most used boating app at least in the Netherlands. The developers got thousands of complaints from apple users and in spite of specifying that location services can be used always as specified by the developers the user should do,all these users couldn’t use the app and basically had to buy an Android phone! Actually the developpers were totally in the dark because it had worked properly before. So Is there a work around?? (I am building now a little device to keep my iphone mechanically moving now as a solution but I prefer as software solution!!!!)
2
0
185
2w
Map behaves differently compared to MKMapView
Hey, I have a problem. I was using MKMapView in my app, and in the view where I had a background at the top of the screen, in the example it was Color.red, it extended all the way to the top of the screen. Now, I wanted to switch to the newer Map and I'm seeing an issue because I'm getting a navigation bar that cuts off my color as I indicated in the picture. Does anyone know why this is happening and if there's another way to achieve this? Steps to reproduce: Change MapView() to Map() to see difference import SwiftUI import MapKit @main struct TestAppApp: App { var body: some Scene { WindowGroup { ContentView() } } } struct ContentView: View { var body: some View { NavigationStack { ScrollView(.vertical) { Color.red .padding(.top, -200) .frame(height: 200) MapView().frame(minHeight: 300) // change this line to Map } .navigationTitle("Title") .navigationBarTitleDisplayMode(.large) } } } private typealias ViewControllerRepresentable = UIViewControllerRepresentable struct MapView: ViewControllerRepresentable { typealias ViewController = UIViewController class Controller: ViewController { var mapView: MKMapView { guard let tempView = view as? MKMapView else { fatalError("View could not be cast as MapView.") } return tempView } override func loadView() { let mapView = MKMapView() view = mapView } } func makeUIViewController(context: Context) -> Controller { Controller() } func updateUIViewController(_ controller: Controller, context: Context) { update(controller: controller) } func update(controller: Controller) { } } #Preview { ContentView() } I got: I want:
1
0
181
2w