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 not yet marked as solved
1 Replies
122 Views
My MacBook Air M2 system version macOS Sonoma 14.5 Beta (23F5049f) The error occurred: from the end of March 2024 to today (April 8, 24) Problem: The system positioning information is seriously wrong, including but not limited to: time zone, Safari, map app, weather app, search app... (PS. The positioning is correct when using Google Chrome and Google Maps, but it is still wrong when using Google Maps on Safari) Background: I came to Germany from mainland China at the end of March. The Apple ID region I use is Germany. The location of my iPhone and Apple Watch can be refreshed to Germany normally, and several of my AirTags have been refreshed to Germany. Tried but failed: I searched for some bash commands to try to clear and clear the cache of the map app and system location information. rm -rf ~/Library/Containers/com.apple.Maps rm -rf ~/Library/Application\ Support/com.apple.findmy sudo rm -rf /Library/Caches/com.apple.GeoServices sudo rm -rf /Library/Caches/com.apple.locationd defaults delete com.apple.locationd.plist Turn off location services in System Settings > Privacy and Security, shut down and restart the phone, and then turn the service back on. Turn my VPN on and off. Clear my network information. Since there are many files saved, the restore operation is not planned. 我的MacBook Air M2 系统版本macOS Sonoma 14.5 Beta版(23F5049f) 错误发生时间:2024年3月底到今天(24年4月8日) 问题:系统定位信息严重错误,包括但不限于:时区、Safari、地图app、天气app、查找app... (PS.使用Google Chrome浏览器与Google Maps时定位正确,Safari使用Google Maps仍然错误) 背景: 我从3月底从中国大陆来到欧洲德国。 我使用的Apple ID地区是德国的。 我的iPhone和Apple Watch定位能正常刷新到德国,且我几个AirTag已经刷新到德国。 尝试但都未成功: 我搜索了一些bash命令尝试清除、清空地图app和系统位置信息的缓存。 rm -rf ~/Library/Containers/com.apple.Maps rm -rf ~/Library/Application\ Support/com.apple.findmy sudo rm -rf /Library/Caches/com.apple.GeoServices sudo rm -rf /Library/Caches/com.apple.locationd defaults delete com.apple.locationd.plist 关闭系统设置>隐私与安全中的定位服务,关机重启,再重开这项服务。 开关我的VPN。 清除我的网路信息。 由于保存的文件较多,不打算进行还原操作。
Posted
by TifaPlove.
Last updated
.
Post not yet marked as solved
0 Replies
168 Views
Hello dear when i use geolocator after i'll get this error Could not build the precompiled application for the device. Error (Xcode): Undefined symbol: OBJC_CLASS$_LocationServiceStreamHandler Error (Xcode): Undefined symbol: OBJC_CLASS$_PositionStreamHandler Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation) Error launching application on iPhone. and didn't app running so plz guide i'm a too much upset
Posted
by AliSindhi.
Last updated
.
Post not yet marked as solved
0 Replies
120 Views
I'm trying to create an app where the user guesses their location, so I'd love to hide the road name and country in the MKLookAroundView. I have already seen some apps pull this off and I'm wondering how to do it. I tried this, but it's not working: struct LookAroundView: UIViewControllerRepresentable { @Binding var isExpanded: Bool @Binding var initialScene: MKLookAroundScene? func makeUIViewController(context: Context) -> MKLookAroundViewController { let lookAroundViewController = MKLookAroundViewController() lookAroundViewController.isNavigationEnabled = true lookAroundViewController.showsRoadLabels = false // I thought this would hide road labels but it doesn't lookAroundViewController.pointOfInterestFilter = .excludingAll lookAroundViewController.badgePosition = .bottomTrailing if let initialScene = initialScene { lookAroundViewController.scene = initialScene } return lookAroundViewController } func updateUIViewController(_ uiViewController: MKLookAroundViewController, context: Context) { uiViewController.isNavigationEnabled = isExpanded uiViewController.showsRoadLabels = false //This was my last idea } }
Posted
by vncntwww.
Last updated
.
Post not yet marked as solved
1 Replies
505 Views
How would one update the position of a SwiftUI Map without impacting the zoom (or distance from a MapCamera point of view). So want: a) map position being updated by incoming GPS co-ordinates b) user may then on the Map zoom in/out c) on subsequent GPS position changes I want to to keep the zoom/distance changes from the User and not reset these From the code below the the issue seems to be when getting the current "distance" (i.e. mapCamPost.camera?distance) that this value seems to go to "nil" after the User zooms in the map. struct GCMap: View { @StateObject var locationMgr = GcFlightState() @State private var mapCamPos: MapCameraPosition = .automatic var body: some View { ZStack { Map(position: $mapCamPos) { Annotation("UserLocation", coordinate: self.locationMgr.location.coordinate) { Image(systemName: "airplane.circle").rotationEffect(.degrees(270)) } } .onMapCameraChange() { print("onMapCameraChange \(mapCamPos.camera?.distance)") } .onReceive(locationMgr.$location) { location in mapCamPos = .camera(MapCamera( centerCoordinate: location.coordinate, distance: mapCamPos.camera?.distance ?? 1000, // <<=== heading: location.course )) } } } }
Posted
by callagga.
Last updated
.
Post not yet marked as solved
0 Replies
123 Views
Hello there, Mainland china user(s) have trouble accessing MapKitJS, keeps returning HTTP 401 unauthorized for https://cdn.apple-mapkit.com/ma/bootstrap?apiVersion=2&mkjsVersion=5.77.35. The same valid JWT perfectly works for users rest of the world. May i know is there any special handling needed for accessing mapkitJS on web from mainland china compared to rest of the world. Advises are highly appreciated.
Posted
by nrkj.
Last updated
.
Post not yet marked as solved
0 Replies
133 Views
Hi I want to inquire about the data returned from CoreLocation update and whether it is accurate. I am attempting to retrieve the local address in Japan based on the postal code, and I have observed differences in the returned data. When calling the information retrieval function with the postal code 3360042, the returned data is as follows: Locality: さいたま市 SubLocality: 南区 Corresponding to Japan Post: https://www.post.japanpost.jp/cgi-zip/zipcode.php?pref=11&city=1111080&id=38748 the displayed information on the website includes "Locality + SubLocality". When calling the information retrieval function with the postal code 1350064, the returned data is as follows: Locality: 江東区 SubLocality: 青海 Corresponding to Japan Post japan post: https://www.post.japanpost.jp/cgi-zip/zipcode.php?pref=11&city=1111080&id=38748 the displayed information on the website only includes "Locality" not includes SubLocality. Is it possible that CoreLocation has been updated? The current data seems to deviate from the design of our application. Please provide me with a solution to determine when to use "Locality + SubLocality" versus just "Locality" to obtain the local address. Thank.
Posted Last updated
.
Post not yet marked as solved
0 Replies
261 Views
Two separate app projects need maps or navigation: Offline map: offline vector map of small city needed within the app (avoiding any online connection after the app's install). Apple Maps requires map tile download after installation. What is an alternative solution? Navigation: An app with a list of locations where we don't want to build-in maps or navigation. Would it be possible to allow the user to click on a location, app copies GPS coordinates, and opens default iOS navigation app and navigates from there instead? Working in Xcode with Swift and SwiftUI.
Posted
by Filip27.
Last updated
.
Post not yet marked as solved
0 Replies
217 Views
My macOS application is trying to fetch location, but everytime LocationManager responds with locationUnknown. Application is granted with permission to access location. Issue is seen in only one device with OSVersion: 14.2.1(23C71), chipset: Apple M1 pro. Other devices with same OS don't have this issue. My application is a background agent, means it has given UIElement in the plist. Issue persists even after restarting device, re-installing application, re-applying location permission. But Google Chrome shows correct location when using Openstreet Map or Google Maps. Is there any troubleshoot/alternative methods here? Any idea why it occurs? Code: if CLLocationManager.locationServicesEnabled() { if #available(OSX 10.14, *) { self.locationManager.requestLocation() } else { // Fallback on earlier versions self.locationManager.startUpdatingLocation() } } I need to get location in certain intervals. So After LocationManager updates I stop location with locationManager.stopUpdatingLocation() and request again after the interval.
Posted Last updated
.
Post not yet marked as solved
1 Replies
296 Views
Hi everyone! I'm working on an app to submit to the Swift Student Challenge this year and wanted to get some feedback on my plan to use MapKit. I know Apple is pretty open to using any of their frameworks for the contest. But I wanted to see if anyone had insights on whether my use of MapKit would comply with the contest rules and eligibility criteria. Any thoughts or advice you have on properly leveraging MapKit for my submission would be much appreciated! I want to make sure I avoid any issues since this framework is so integral to my app idea. Let me know if you have built a map-based app for Swift Student Challenge before as well. Thanks!
Posted Last updated
.
Post not yet marked as solved
0 Replies
236 Views
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 }
Posted
by AndrewH.
Last updated
.
Post not yet marked as solved
0 Replies
268 Views
CLMonitor WWDC video, it says the same name can be reused await CLMonitor("greeting") but the production iOS 17 API actually crashes. Is this the correct behaviour? (See screenshot 1) for try await events in monitor.events should work in from the WWDC video, but the production iOS 17 API does not work and need to insert await after in keyword. Also, never received any events from the monitor (See screenshot 2) WWDC Video: https://developer.apple.com/wwdc23/10147
Posted
by John-Doe.
Last updated
.
Post not yet marked as solved
1 Replies
322 Views
We are implementing indoor positioning and proximity sensing in our iOS app using iBeacons. We have placed multiple beacons to detect the proximity of one point of interest(POI). We are using the startRangingBeacons method in the CLLocationManager class and implementing corresponding delegates to receive the ranging information. With all required foreground and background permissions granted, when a user walks from one POI to another, beacon ranging is working as expected and we are continuously receiving the sightings in the app. We have observed that, if user stops walking for a few minutes at a POI and then device automatically pauses the scan. Hence, we will not receive any beacon signals. When there is a movement, it performs beacon ranging again for a minute or so, then stops again for longer time even when user is walking. The interval between the pausing and resuming the service is not a constant. We have also observed that sometimes it takes more than 15 minutes to resume the service once the system pauses the ranging automatically. Is it an expected behavior? How long does it usually take for beacon ranging services to resume after the user starts moving? Is there any way we can reduce this delay between the pause and resume of ranging beacons? Appreciate your support
Posted
by Mijesh.
Last updated
.
Post not yet marked as solved
1 Replies
969 Views
In UIKit, we can add an insets to a MKMapView with setVisibleMapRect to have additional space around a specified MKMapRect. It's useful for UIs like Apple Maps or FlightyApp (see first screenshot attached). This means we can have a modal sheet above the map but still can see all the content added to the map. I'm trying to do the same for a SwiftUI Map (on iOS 17) but I can't find a way to do it: see screenshot 2 below. Is it possible to obtain the same result or should I file a feedback for an improvement?
Posted
by alpennec.
Last updated
.
Post not yet marked as solved
0 Replies
246 Views
Hi All, I need user continues location event if app in background and terminated (Not-running) mode below is the code I'm using to get the location but still I'm not get the location continuously import BackgroundTasks import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { var significatLocationManager: CLLocationManager? func startSignificationLocation() { self.significatLocationManager = CLLocationManager() self.significatLocationManager?.delegate = self self.significatLocationManager?.activityType = .fitness self.significatLocationManager?.distanceFilter = 10 self.significatLocationManager?.desiredAccuracy = kCLLocationAccuracyNearestTenMeters self.significatLocationManager?.allowsBackgroundLocationUpdates = true self.significatLocationManager?.pausesLocationUpdatesAutomatically = false self.significatLocationManager?.startUpdatingLocation() self.significatLocationManager?.startMonitoringSignificantLocationChanges() self.significatLocationManager?.requestAlwaysAuthorization() } func stopAllRegionMonitoring(locationManager:CLLocationManager?){ for delRegion in (locationManager?.monitoredRegions ?? []){locationManager?.stopMonitoring(for: delRegion)} } } extension AppDelegate: CLLocationManagerDelegate { func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { self.myLocation = locations.last //call update My Location API if (self.myLocation?.horizontalAccuracy ?? 0.0) <= (self.liveLocationTrackingRegionRadius + 15.0 ){ self.createRegion(location: self.myLocation) } else { manager.stopUpdatingLocation() manager.startUpdatingLocation() } } func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {} func locationManagerDidPauseLocationUpdates(_ manager: CLLocationManager) { manager.startUpdatingLocation() } func locationManagerDidResumeLocationUpdates(_ manager: CLLocationManager) { manager.startUpdatingLocation() } } extension AppDelegate { func createRegion(location:CLLocation?, type:LocationRegionMonitoringTyep = .LiveLocationTracking) { if self.significatLocationManager == nil { self.startSignificationLocation() } guard let location = location else { return } guard CLLocationManager.isMonitoringAvailable(for: CLCircularRegion.self) else{ return } var identifier:String = "Live_Location_Tracking-" + "\(location.coordinate.latitude)" + "-" + "\(location.coordinate.longitude)" if (self.significatLocationManager?.monitoredRegions.count ?? 0) > 10 { self.stopAllRegionMonitoring(locationManager: self.significatLocationManager) } var region : CLCircularRegion? region = CLCircularRegion(center: CLLocationCoordinate2D(latitude: location.coordinate.latitude,longitude: location.coordinate.longitude),radius: 10.0 ,identifier: identifier) region?.notifyOnExit = true self.significatLocationManager?.startUpdatingLocation() if let reg = region { self.significatLocationManager?.startMonitoring(for: reg) } } func stopAllRegionMonitoring(locationManager:CLLocationManager?){ let WOMRequestId:String? = UserDefaultManager.shared.womEmergencyDetails?.data?.request?.id for delRegion in (locationManager?.monitoredRegions ?? []){ if let reqId = WOMRequestId { if delRegion.identifier.contains(reqId) { locationManager?.stopMonitoring(for: delRegion) } } else { locationManager?.stopMonitoring(for: delRegion) } } } func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) { if region.identifier.contains(AppConstants.WatchOverMe) { AppDelegate.shared?.isWOMReachDestination(location: manager.location, region: region) } } func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { self.myLocation = manager.location manager.stopMonitoring(for: region) self.significatLocationManager?.stopMonitoring(for: region) manager.startUpdatingLocation() self.significatLocationManager?.startUpdatingLocation() self.createRegion(location: self.myLocation) //update M yLocation API if region.identifier.contains( AppConstants.WatchOverMe ) { TabBarController.isWOMReachDestinationAlertShown = false } } func locationManager(_ manager: CLLocationManager, monitoringDidFailFor region: CLRegion?, withError error: Error) { self.myLocation = manager.location self.createRegion(location: self.myLocation) } } extension AppDelegate { func applicationDidEnterBackground(_ application: UIApplication) { self.scheduleBackgroundTask() } func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { completionHandler(.newData) } func registerBGTask(){ BGTaskScheduler.shared.register(forTaskWithIdentifier: self.getBGTaskIdentifier(), using: nil) { task in self.handleBackgroundTask(task: task as! BGAppRefreshTask) } } func handleBackgroundTask(task: BGAppRefreshTask) { task.setTaskCompleted(success: true) } func scheduleBackgroundTask() { let request = BGAppRefreshTaskRequest(identifier: self.getBGTaskIdentifier() ) request.earliestBeginDate = Date(timeIntervalSinceNow: 10) // 30 second do { try BGTaskScheduler.shared.submit(request) } catch { print("Unable to schedule background task: (error)") } } func getBGTaskIdentifier()->String { let bundleId:String = AppInfoManager.shared.bundleId + ".locationBackgroundTask" return bundleId } func startLocationTrackingTimer() { self.stopLocationTrackingTimer() self.locationTrackingTimer = Timer.scheduledTimer(timeInterval: 1.0,target: self, selector: #selector(self.updateUserLocation),userInfo: nil,repeats: true) RunLoop.current.add(self.locationTrackingTimer!, forMode: .common) } func stopLocationTrackingTimer() { self.locationTrackingTimer?.invalidate() self.locationTrackingTimer = nil } @objc func updateUserLocation() { if self.isSocketActive { self.updateMyLocationAPI(fromRoam: false) } else { self.updateUserCurrentLocation() } } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
318 Views
I am using CLLocationUpdate.liveUpdates() and CLBackgroundActivitySession to receive background location updates. My app has "Always" authorization, but I can not get rid of the top left "Blue bar" in any way except for by manually closing the app (swipe up in multi-app preview view). I have tried setting CLLocationManager.showsBackgroundLocationIndicator = false but it does not make any difference. How can I get rid of the blue bar in the top left corner? My project started from this WWDC23 sample code Has "always" location authorisation through CLLocationManager.requestAlwaysAuthorization() Has UIBackgroundModes - location set in Info.plist Tested multiple days with a real iPhone 14, iOS 17.2 (although an iPhone SE gen2 iOS 17.2 seems to loose the blue bar after a while)
Posted
by Wallman94.
Last updated
.
Post not yet marked as solved
0 Replies
203 Views
In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.
Posted Last updated
.