Build maps and location awareness capabilities into your apps.

All subtopics

Post

Replies

Boosts

Views

Activity

GeoLocator in flutter
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
0
0
423
Mar ’24
How can I remove the street names in the MKLookAroundView?
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 } }
0
1
307
Mar ’24
mapkitJS HTTP-401 Unauthorized only for Mainland China
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.
0
1
349
Mar ’24
CoreLocation returns asynchronous data that may not be synchronized with Japan Post's data
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.
0
0
281
Mar ’24
Built-in offline maps & navigation in external iOS app
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.
0
0
495
Mar ’24
LocationManager responds locationUnknown only
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.
0
0
360
Feb ’24
Use of MapKit on my submission
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!
1
0
437
Feb ’24
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 }
0
0
388
Feb ’24
CLMonitor is Not Working and No way to debug!
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
0
2
423
Feb ’24
Beacon ranging when the device is idle
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
1
0
486
Feb ’24
how to get user live location in Background and terminated mode?
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() } } }
0
0
343
Jan ’24
iOS17 CLLocationUpdate Blue bar
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)
3
0
585
Jan ’24
Searching for an example of a proper iBeacon implementation for iOS 17
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
3
0
703
Jan ’24
change SwiftUI Map position without resetting distance?
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 )) } } } }
1
0
872
Jan ’24