Maps and Location

RSS for tag

Build maps and location awareness capabilities into your apps.

Posts under Maps and Location tag

85 Posts
Sort by:
Post marked as solved
3 Replies
523 Views
Hello, I'm looking for an end-to-end example project that shows a correct implementation for the new iBeacon CoreLocation APIs in iOS 17.0 (CLMonitor, etc.). Ideally the example would cover background waking as that is the area in which I am facing the largest challenges. Perhaps there's an Open Source project or an official Apple example? Thanks for pointing me in the right direction. Jeremy
Posted Last updated
.
Post not yet marked as solved
1 Replies
398 Views
Case-ID: 4977264 I am writing to inquire about the status of my location push service extension entitlement, which I submitted a consent form for on November 16, 2023., It has been 50 days with no response from Apple since I submitted, Can anyone help regarding the entitlement and why Apple takes time to approve OR is there any specific reason to deny entitlement? Thanks in advance.
Posted Last updated
.
Post not yet marked as solved
6 Replies
2.9k Views
I have given location permission for the app i'm developing. Now i need to reset location permission and want to see the permission pop-up. I have tried tccutil reset and /var/db/locationd/clients.plist is not accessible. Both are failing even with sudo. Please suggest any methods.
Posted Last updated
.
Post marked as solved
2 Replies
742 Views
Anyone able to see how to use the new SwiftUI Map and WWDC @Observable concept to dynamically update my SwiftUI Map position and rotation based on the dynamic changes it picks up from my @Observable object. Note the updates are coming through as the Text labels show this. But how to get the Map position referencing the same values and updating them? The "onAppear" approach doesn't seem to work. import SwiftUI import MapKit @Observable final class NewLocationManager : NSObject, CLLocationManagerDelegate { var location: CLLocation? = nil var direction: CLLocationDirection = 0 private let locationManager = CLLocationManager() func startCurrentLocationUpdates() async throws { if locationManager.authorizationStatus == .notDetermined { locationManager.requestWhenInUseAuthorization() } for try await locationUpdate in CLLocationUpdate.liveUpdates() { guard let location = locationUpdate.location else { return } print("NewLocationManager: \(location.coordinate.latitude), \(location.coordinate.longitude)") self.location = location self.direction = self.direction + 1 } } } struct ContentView: View { var locationMgr = NewLocationManager() @State private var mapCamPos: MapCameraPosition = .automatic private let bigBen = CLLocationCoordinate2D(latitude: 51.500685, longitude: -0.124570) var body: some View { ZStack { Map(position: $mapCamPos) .onAppear { // Does NOT work - how to get position/direction updates working to Map (map should be moving/rotating) mapCamPos = .camera(MapCamera( centerCoordinate: self.locationMgr.location?.coordinate ?? bigBen, distance: 800, heading: self.locationMgr.direction )) } VStack (alignment: .leading) { Text("Location from observable: \(locationMgr.location?.description ?? "NIL")") // This works (they get updates regularly) Text("Direction from observable: \(locationMgr.direction)") // This works (they get updates regularly) Spacer() } } .task { try? await locationMgr.startCurrentLocationUpdates() } } } #Preview { ContentView() } Tag: wwdc2023-10043
Posted
by callagga.
Last updated
.
Post not yet marked as solved
3 Replies
1.8k Views
Hi, I'm looking through SwiftUI Map for SwiftUI documentation (including IOS17 Beta) for way to adjust Map() scale, or zoom level, while simultaneously showing user's location and heading, for which I'm doing this @State var position = MapCameraPosition = .userLocation(followsHeading: true, fallback: .automatic) Map(position: $position) It does not appear to be possible so am looking for confirmation. Thanks everyone.
Posted
by macmac72.
Last updated
.
Post not yet marked as solved
1 Replies
532 Views
Trying to use new Swift @Observable to monitor GPS position within SwiftUI content view. But how do I tie the latest locations to the SwiftUI Map's mapCameraPosition? Well ideally the answer could cover: How to fix this error - So get map tracking along with the User Position, but also How to include facility to turn on/off the map moving to track the user position (which I'll need to do next). So could be tracking, then disable, move map around and have a look at things, then click button to start syncing the mapcameraposition to the GPS location again Refer to error I'm embedded in the code below. import SwiftUI import MapKit @Observable final class NewLocationManager : NSObject, CLLocationManagerDelegate { var location: CLLocation? = nil private let locationManager = CLLocationManager() func startCurrentLocationUpdates() async throws { if locationManager.authorizationStatus == .notDetermined { locationManager.requestWhenInUseAuthorization() } for try await locationUpdate in CLLocationUpdate.liveUpdates() { guard let location = locationUpdate.location else { return } self.location = location } } } struct ContentView: View { var newlocationManager = NewLocationManager() @State private var cameraPosition: MapCameraPosition = .region(MKCoordinateRegion( center: newlocationManager.location?.coordinate ?? <#default value#>, span: MKCoordinateSpan(latitudeDelta: 0.25, longitudeDelta: 0.25) )) // GET ERROR: Cannot use instance member 'newlocationManager' within property initializer; property initializers run before 'self' is available var body: some View { ZStack { Map(position: $cameraPosition) Text("New location manager: \(newlocationManager.location?.description ?? "NIL" )") // works } .task { try? await newlocationManager.startCurrentLocationUpdates() } } } #Preview { ContentView() }
Posted
by callagga.
Last updated
.
Post not yet marked as solved
0 Replies
348 Views
Regardless of how much information is provided to the Maps searchAutoComplete API, the response field structuredAddress is always null. This means I have to call the completionUrl afterwards to get a structured address. This consumes our quota and causes unnecessary Maps traffic. Example request, autocompleting "450 Post St, San Francisco": https://maps-api.apple.com/v1/searchAutocomplete? q=450%20Post%20St%2C%20San%20Francisco &resultTypeFilter=Address &limitToCountries=US &lang=en-US responds 2 results with the actual address found, but each having only these fields: - completionUrl - displayLines - location Example: { "results": [ { "completionUrl": "/v1/search?q=450%20Post%20St%20San%20Francisco%2C%20CA%2C%20United%20States&metadata=Ch8KCzQ1MCBQb3N0IFN0EgQIABADEgQIBBAEEgQICRACEjQKIFNhbiBGcmFuY2lzY28sIENBLCBVbml0ZWQgU3RhdGVzEgQIGhACEgQIABADEgQIBBAJGAIyRgoSCQAAAEDg5EJAEQAAAOA9ml7AEM6h0aK1wfKqciA5KQAAAAAAAHlAgvEEAzQ1MIjxBDGa8QQCVVOg8QQAsvEEALrxBABiHAoaNDUwIFBvc3QgU3QsIFNhbiBGcmFuY2lzY2%2BC8QQaNDUwIFBvc3QgU3QsIFNhbiBGcmFuY2lzY2%2BI8QQA2vEEFgkAAABAEf3IQBkAAAAAAAAAACABKAPq8QQAkPIEAQ%3D%3D", "displayLines": [ "450 Post St", "San Francisco, CA, United States" ], "location": { "latitude": 37.78809356689453, "longitude": -122.41002655029297 } }, { "completionUrl": "/v1/search?q=450%20Post%20St%20Napa%2C%20CA%2C%20United%20States&metadata=****", "displayLines": [ "450 Post St", "Napa, CA, United States" ], "location": { "latitude": 38.30093002319336, "longitude": -122.27799224853516 } } ] } Anyone figured this out? Seems buggy to me.
Posted
by steluhh.
Last updated
.
Post not yet marked as solved
0 Replies
427 Views
Question: Does anyone have experience or documentation on how to get an App Clip to show on Apple Maps for a location? What I've tried: I have tried to associate my App Clip with an Apple Maps location. We are working with a physical restaurant that has an Apple Maps location, our full app is listed there but not the App Clip. I've gone through the steps of setting up the Advanced App Clip Experience and giving it the location we want it associated with, and have gone through Apple Business Connect and done all the setup there to get the full app to show with the location, but the app clip still does not show. I've contacted Apple Support and they gave me the criteria of "The App Clip is hosted within the app" and "The app is associated to the same physical location". When asking for clarification with the first criteria they said they could help and closed the chat.
Posted Last updated
.
Post not yet marked as solved
2 Replies
409 Views
I have recently been approved for the location push service extension. I do not have as much experience working directly in swift. I am trying to Implement so that when this Location Push Notification is received by the device it responds to the server with the current location. I have the proper APNS set up and have already been approved. Is there a step by step guide to help implement this feature.
Posted
by LloydELVT.
Last updated
.
Post not yet marked as solved
0 Replies
523 Views
I'm working on an in-house iOS app designed to help users accurately track their routes during trips. Currently, I've implemented a method to track users when the app is open in the background. However, I'm facing challenges, as the tracking stops when the device is locked for more than 10 minutes. I'm looking for a solution to continuously track a user's geolocation, even if the app is closed or not in use. Specifically, I want to ensure uninterrupted tracking, especially when the device is locked. Here are some key points: Current Method: I'm currently using the Core Location method and a combination of background tasks and a repeating timer to fetch the user's location and update a log for geolocation tracking when the app is open in the background. Issues Faced: The tracking stops when the device is locked for more than 10 minutes. This limitation impacts the accuracy of the route tracking during longer trips. Objective: My goal is to achieve continuous geolocation tracking, even when the app is closed or not actively used, to provide users with a seamless and accurate record of their routes. Platform: The app is developed for iOS using the .net maui platform, and I'm seeking solutions or suggestions that are compatible with the iOS .net maui environment. If anyone has experience or insights into achieving continuous geolocation tracking on iOS, especially when the app is not in use or the device is locked, I would greatly appreciate the assistance.
Posted Last updated
.
Post marked as solved
1 Replies
480 Views
I'am developing an iOS widget for my weather app, where the user can set the widget to "My location". This means the widget needs to be refreshed on location changes. Since a widget can't run a location manager in the background, apple tech support wrote that you have to setup a location manager in the main app and share the updated location data over App groups to the widget. This part works fine. I also managed to setup a location manager running in the background, but it uses too much battery and shows always the location indicator on top (blue bar) if the app is running, but I don't need this since its not a navigation app or something similar. How to configure a lightweight location manager running in the background? class WidgetLocationManager: NSObject, CLLocationManagerDelegate { static let shared: WidgetLocationManager = WidgetLocationManager() let manager = CLLocationManager() override init() { super.init() manager.delegate = self manager.desiredAccuracy = kCLLocationAccuracyKilometer manager.distanceFilter = 1000 manager.allowsBackgroundLocationUpdates = true manager.pausesLocationUpdatesAutomatically = false manager.activityType = .other manager.showsBackgroundLocationIndicator = false } func setupWidgetLocationManager() { manager.requestWhenInUseAuthorization() manager.startUpdatingLocation() manager.startMonitoringSignificantLocationChanges() } func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) { if manager.authorizationStatus == .notDetermined || manager.authorizationStatus == .denied || manager.authorizationStatus == .restricted { manager.stopUpdatingLocation() manager.stopMonitoringSignificantLocationChanges() } if manager.authorizationStatus == .authorizedAlways || manager.authorizationStatus == .authorizedWhenInUse { manager.startUpdatingLocation() manager.startMonitoringSignificantLocationChanges() } } func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { if let newestLocation = locations.last { UserDefaults(suiteName: "group.com.***")?.set(Double(newestLocation.coordinate.latitude), forKey: "newest_location_latitude") UserDefaults(suiteName: "group.com.***")?.set(Double(newestLocation.coordinate.longitude), forKey: "newest_location_longitude") UserDefaults(suiteName: "group.com.***")?.set(Double(newestLocation.altitude), forKey: "newest_location_altitude") WidgetCenter.shared.reloadAllTimelines() } } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) { } } Capability for background modes location is set, also mandatory strings in info.plist for location privacy info.
Posted Last updated
.
Post not yet marked as solved
1 Replies
326 Views
I have applied twice for Location Push service entitlement , the first time was last year and I forgot about it but I just checked my emails and I have found no response from apple at all , only the case-id from the automated email and now I applied for it again and no response can someone advice me what shall I do ?? my app really depends on it
Posted
by rulefahd.
Last updated
.
Post not yet marked as solved
0 Replies
378 Views
Can Mapkit show me details about bus stops, train stations, underground and overground stops, or other public transportation locations based on a specific latitude and longitude? If you check the Google Maps picture I shared, I marked all the public transportation spots near Elephant & Castle in London. This includes bus stops, the Elephant & Castle Underground station, and the Elephant & Castle Rail station. Additionally, tapping on these spots brings up an alert with more info, like which buses are coming or details about train lines.
Posted
by AKA77.
Last updated
.
Post not yet marked as solved
0 Replies
336 Views
Does any Apple API support the Location management for the business? I am interested in if I am able to integrate an Apple business into my application. The first thing I care about is business location management (I would like to create/edit the location via an API call)
Posted Last updated
.
Post not yet marked as solved
0 Replies
342 Views
In our placation there are instances of crashes that are happening in production. That we cannot quite reproduce. Looking at the crash report doesn't reveal much as the crashed thread doesn't give too much information of where to look for the root cause of the problem. In our app we are also using third-party libraries but I didn't see that they might be the cause for the crash. Crash report If someone can point me in the right direction to look for or how to investigate it. It would much appreciated.
Posted
by kesleme.
Last updated
.
Post not yet marked as solved
1 Replies
304 Views
Hello. I've submitted a small update for my app and i received an email that said: "The “” value for the NSLocationWhenInUseUsageDescription key isn’t allowed " I have values for the above key in English and Greek in InfoPlist files and they are appearing correctly when the app is asking for location permissions. It has been like this for years and i didn't change anything related to this function. Can someone please explain to me why i received this email although i've set everything correctly?
Posted
by jimdem582.
Last updated
.
Post marked as solved
3 Replies
592 Views
At the moment with my app Users have to go to Privacy & Security -> Locations Services -> On -> Scroll down to my app and turn on their Location Preference. I am trying to incorporate in to my app the Code below to make it unecessary to leave the app to enable the User‘s location to be displayed but it does not work. Please tell me, what am I missing here? import MapKit import SwiftUI import CoreLocation // Prompt User to choose Location Preference // class ViewController: UIViewController, CLLocationManagerDelegate{ var locationManager: CLLocationManager? override func viewDidLoad() { super.viewDidLoad() locationManager = CLLocationManager() locationManager?.delegate = self locationManager?.requestWhenInUseAuthorization() view.backgroundColor = .gray } } // The rest of the Code which is working okay ( Map etc.) // struct Positions: Identifiable { let id = UUID() let name: String let latitude: Double let longitude: Double var coordinate: CLLocationCoordinate2D { CLLocationCoordinate2D(latitude: latitude, longitude: longitude) } } etc. etc.
Posted
by GMacD53.
Last updated
.
Post not yet marked as solved
0 Replies
403 Views
Is there a way of deleting an app from the Location Services in the Privacy Setting? Despite deleting the particular app evidence of it remains. Also with a particular app there are several of the same in the list. I do understand there may be one for the Playgrounds version and one for the actual downloaded version but I have more. Is there a way of starting with a clean slate?
Posted
by GMacD53.
Last updated
.