Core Location

RSS for tag

Obtain the geographic location and orientation of a device using Core Location.

Core Location Documentation

Posts under Core Location tag

161 results found
Sort by:
Post not yet marked as solved
38 Views

iOS 15 New Location APIs

The latest betas have new API in Core Location around "location pushes" including: CLLocationManager.startMonitoringLocationPushes CLLocationManager.stopMonitoringLocationPushes protocol CLLocationPushServiceExtension CLLocationPushServiceError Does anyone know what these are for? I couldn't find anything in the WWDC sessions, or general web searches.
Asked
by jjatie.
Last updated
.
Post not yet marked as solved
444 Views

MapKit JS poor webperf (performance issues)

Hello,We're using MapKit JS for the web in a very simple way. The problem is that PageSpeed Insights or Lighthouse raises question reguarding poor performance caused by MapKit JS.For example, on this pagespeed insights (but you get more detailed results if you run the test straight from your browser using chrome devtools audit section):Script evaluation takes about 2,5 to 3 seconds on a simulated slow 4G, 4x CPU slowdown (see this screenshot).Assets are not served using HTTP2, and since a lot of assets transfer through (on my example, I count 120 HTTP requests to cdn*.apple-mapkit.com). I think multiplexing could do a lot of good there if it were using HTTP2 protocol;I ran locally the chrome audit on my MacbookPro 15" 2019, with 2,3Ghz Intel Core I9, 32Go ram. We're using the latest version of MapKit JS (5.x.x).No fancy stuff was done, it's a "default" map (~650x220px) , zoom 13, and place a single marker on it to show a particular address)Other "minors":- it complains about the image format that are not using next-gen formats.Is there a thing I'm missing ? Is it something you're working on or/and aware ?Thank you;
Asked
by dev-yprox.
Last updated
.
Post not yet marked as solved
20 Views

Application name not appear on settings screen when Location service permission selected in app.

When “Don’t allow" (or any other option) is selected on the permission confirmation screen of location service, and no other permission (camera or photo library access permission) selection operation is performed. Application name will not appear on settings screen. However, application is appearing in Settings -> Privacy -> Location Services
Asked
by reddy_krk.
Last updated
.
Post not yet marked as solved
54 Views

Location permission request popup not working as expected in iPad split view

Hi I am working on my app to support ipad split view. My problem is that the location permission request popup doesn't appear immediately when split view is activated. The summarized code is below. import CoreLocation class MyViewController: UIViewController {   var locationManager = CLLocationManager()   //skip code...    @objc func touchUpInsideLocationButton(_ sender: Any) {     self.locationManager.requestWhenInUseAuthorization()   } } After the code that handles the button touch is executed, the system popup requesting the location permission does not appear. When I close the iPad split view (Drag the app divider to the left or right edge of the screen), a system popup appears at that time. When requesting permission to access photos in iPad split view, a system pop-up appeared immediately. The location information permission popup should also appear immediately, but I'm not sure if it's a bug or the intended behavior. Please help. Have a nice day 😄
Asked
by jhkim.
Last updated
.
Post not yet marked as solved
54 Views

Xcode Location Simulator

Hi! I am doing a project with location simulators, and I am trying to figure out how to simulate my location with latitude longitude coordinates via Xcode. I am able to do so with a GPX file, but my location returns to its actual one after a few hours. Is there a way to hardcode it into the system to stay intact until the phone is reset or for n amount of hours? I would like my location to only be accessed when I allow it, specifically through find my. Thank you for any help in advance.
Asked
by pjp.
Last updated
.
Post not yet marked as solved
191 Views

How to test whether iOS app runs on an M1 mac?

My iOS-app shows a map and may be the user's location. At some point it will request the "always" location permission. On iOS all is well. The app also runs pretty neat on M1 macs so far, except for the part where it wants to request that permission. I also think it never asked me for the "Permission when in use" on the M1. However, after the user granted the always-permission on iOS, he'll be shown the screen of the GPS tracker. Since recording GPS tracks doesn't make much sense on M1, I'd like to show the user that screen, but disable the start button. So how do I test for M1? P.S. I'd not ask such a dumb question, if I didn't get this error: (including these strange quotes) „POI Toolbox“ kann nicht installiert werden Domain: IDEInstallLocalMacService Code: 1 Failure Reason: Versuche es später noch einmal. Recovery Suggestion: Failed to finalize LSBundleWrapper mutator instance for {...BUNDLE_ID...} -- System Information macOS Version 11.4 (Build 20F71) Xcode 12.5.1 (18212) (Build 12E507) Timestamp: 2021-06-28T12:31:13+02:00 The "failure reason" doesn't say anything helpful. It means "Try again later."
Asked
by Anticro.
Last updated
.
Post not yet marked as solved
49 Views

CLLocationManager (iOS/macOS) callback change request

When we ask users for permission to use their location, they'll be able to grant permission to "WhenInUse" in the first step. After that the app may ask for "Always" authorization and the user taps 'Change to always'. That's fine. So far... But there is something missing: Issue on the 1st step: An app can't tell the user that the wrong permission button was tapped ('Allow once' is sometimes wrong, see step 2) and to go to the settings to correct that. 'Allow once' is okay to show the user's location on a map. BUT if the app later needs BG permission, step 2 will fail silently. That's confusing to the user, and to the developer! Also, some users get nervous if they encounter such system pop-ups (i.e. see your mothers and fathers) and tend to tap 'Allow once'. (My app shows a map, where 'Allow once' is okay, but it also is a GPS tracker in the 2nd use-case) Issues on the 2nd step: (2.1) Well, the user asks the app to record a GPX track and before he chose 'Allow once' (because he wanted the map to locate himself; the same app session). Guess what? Nothing at all happens. To the user the app appears to be buggy. Since it didn't get any explicit callback by the system it never was able to determine whether another permission request could be successful or not. (2.2) The user selected "WhenInUse" in step (1) and decided to "Keep 'WhenInUse'". Nothing at all happens. Again. Problem here: The user tapped a button and the app doesn't get any callback on this. That probably breaks functionality. I have also tried to receive notifications (about key windows: UIWindowDidBecomeKeyNotification and UIApplicationDidBecomeActiveNotification). But the pop up seems not to be anything like a window or ... whatever would cause the app to resign the active state. So here are my 2 cents. If I'd be the engineer of CLLocationManager, I'd like to change the following (R = Request): (R1) Add CLAuthorizationStatusTemporary (That is: "Allow once only" and means: "You don't even need to ask for 'Always' authorization") (R2) Some in-app mechanism, that would allow the user to correct the choice to "Allow 'WhenInUse'" once. (R3) Always give a feedback on the current authorization status, after the user taps a button. Can we please have these changes?
Asked
by Anticro.
Last updated
.
Post not yet marked as solved
48 Views

Question on AirTags (Wayfinding)

I have AirTags on the iPhone 11, and wonder if it possible to utilize both AirTags in ONE-GO to find an item. Similar to achieving checkpoints in a racing game but instead the checkpoints are the AirTags (wayfinding).
Asked
by adam223.
Last updated
.
Post not yet marked as solved
344 Views

WatchKit CoreLocation to use Watch GPS Chip

TLDR: I want to use the watch GPS for location even when the phone is in range. Previously this was not allowed, but I have recently seen multiple apps that allow you to force their watch extension to use the on-watch GPS for corelocation even when the phone is in range. I understand there is a battery life impact, but this is critical for my application and I have been unable to find how to do it. Help please!
Asked Last updated
.
Post not yet marked as solved
80 Views

CLLocationManager didUpdateLocations not updating while Watch dims

I'm developing a workout app and the app uses routeBuilder to save the workout route along with workout data. The app did as expected (retrieves and saves GPS data) when app is in foreground mode and even in background mode when Apple Watch display is ON ... the problem is when the watch enters the dim state (blur on Always On) then GPS data is received 10-15 more seconds and after that the app stops receiving updates until display is ON again. Background Mode - Location Updates and Workout Processing capabilities are ON , allowsBackgroundLocationUpdates is true, Location When In Use permission is granted. App works fine on simulator. The previous behavior is on an Apple Watch 6, 44mm WatchOS 7.5 (Watch only app)
Asked
by ruribe.
Last updated
.
Post marked as solved
62 Views

Tracking Location

please let me know, is it possible to track location. when app is in TERMINATED or SUSPENDED STATE.
Asked Last updated
.
Post not yet marked as solved
47 Views

SCAN request from locationd blocks WiFi package for 140ms

I test with VLC as RTSP audio client on MacOS. Every 5 minutes, I hear noise. The noise continue for 3 sec, happens every 5 min exactly. During noise period, kernel_task use +25% CPU for 3 sec, Console->wifi.log put message staring with SCAN request received from pid ??? (locationd) with priority=2, qos=-1 (default), frontmost=no I checked Wireshark, it receives RTP/UDP packets every 20ms. But during noise period, no package for 140ms. That makes no sound period and noise. If I disable WiFi and use Ether cable, the noise is gone. If I disable Settings -> Security & Privacy -> Location Services, the noise is gone. Is there any way to receive RTP/UDP package during locationd's scan? My environment: macOS Big Sur ver 11.4 iMac (Retina 5K, 27-inch, 2017) VLC 3.0.16(Intel 64bit)
Asked
by Himadeus.
Last updated
.
Post not yet marked as solved
61 Views

Cannot scan for iBeacons (macOS)

Hello, I am attempting a very simple AppKit app on MacOS which displays nearby iBeacons. I don't appear to ever have region scanning available on my system though. Am I doing something wrong? FYI: My system is a MacBook Pro (16-inch, 2019) running Catalina (10.15.7) The target has 'Bluetooth' and 'App Location' enabled in the 'App Sandbox' capabilities section and 'Location' enabled under 'Hardened Runtime'. For a second question: is it possible to scan for any beacons, not just my own (i.e. scan without setting a proximity UUID)? //  ViewController.swift //  Beacons import Cocoa import CoreLocation class ViewController: NSViewController, CLLocationManagerDelegate {     var locationManager: CLLocationManager!     override func viewDidLoad() {         super.viewDidLoad()         locationManager = CLLocationManager()         locationManager.requestAlwaysAuthorization()         locationManager.delegate = self     }     @IBAction func buttonTapped(_ sender: NSButton) {         self.startScanning()     }     override var representedObject: Any? {         didSet {             // Update the view, if already loaded.         }     }     func startScanning() {         print("starting scanning") //UUID Obscured for forum post...         guard let uuid = UUID(uuidString: "xxxxxxxx-E4A1-4720-9034-xxxxxxxxxxxx") else {             print("Couldn't make UUID")             return         }         let beaconID = "com.monkeyfood.myBeaconRegion"         let beaconRegion = CLBeaconRegion(uuid: uuid, identifier: beaconID) //        let beaconRegion = CLBeaconRegion(uuid: UUID(), identifier: beaconID)         self.locationManager.startMonitoring(for: beaconRegion)     }          //. CLLocationManagerDelegate Methods     func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {         var newStatus = ""         switch status {         case .notDetermined:             newStatus = "Not determined"         case .restricted:             newStatus = "Restricted"         case .denied:             newStatus = "Denied"         case .authorizedAlways:             newStatus = "Authorised Always"         case .authorized:             newStatus = "Authorised"         default:             newStatus = "What?"         }         print("LM Auth Status is now: \(newStatus)") // Check for iBeacon monitoring status         let regionMonitoringIsAvailable = CLLocationManager.isMonitoringAvailable(for: CLBeaconRegion.self)         let not = regionMonitoringIsAvailable ? "" : "not "         print("Beacon monitoring is \(not)available")     }     func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {         if beacons.count > 0 { //            updateDistance(beacons[0].proximity)             print("\(beacons.count) beacons found.")             print("\(beacons[0].proximity) dist.")         } else { //            updateDistance(.unknown)         }     }     func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {         print("region entered... \(region)")     }     func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {         print("region exited... \(region)")     }     func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) {         print("determined  region state")     }     func locationManager(_ manager: CLLocationManager, monitoringDidFailFor region: CLRegion?, withError error: Error) {         print("region monitoring failed: \(error)")     }     func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {         print("LM failed \(error)")     } } Always gives me the following: LM Auth Status is now: Authorised Always Beacon monitoring is not available starting scanning region monitoring failed: Error Domain=kCLErrorDomain Code=5 "(null)"
Asked
by Diggory.
Last updated
.
Post not yet marked as solved
94 Views

How to detect if device clock has been manually adjusted?

Our app provides medical treatment which is time sensitive. The requirement is to notify the user if clock gets manually adjusted and stop the treatment until the user corrects it. The problem is how to detect if device clock has been manually adjusted? Initially, we try to use auto time setting, however, there's no API to retrieve it. Then we decide to use NTP server, but what if there's no internet access? During app launch, if there's no internet access, if kernel boot time has not changed, we can assume the device clock has not been adjusted. If boot time has changed, how can we know the change is due to device reboot or user manually adjusted the clock? Is there a way to use GPS time? CLLocation does give a timestamp, but it's the device timestamp not the location timestamp. Thanks.
Asked Last updated
.
Post not yet marked as solved
89 Views

SwiftUI update Map region causes warning about Modifying state.

I have a project that uses the new SwiftUI Map in iOS 14 I want to be able to update the location of the Map centre dynamically. When you tap the Zoom button and then the Location Button the Map works fine and re-centers to London. However if you just tap the location button it re-centers to London but throws a warning about the ViewState. I am at a loss for what is causing this issue and how to fix it.     @State private var region = MKCoordinateRegion(         center: CLLocationCoordinate2D(             latitude: 25.7617,             longitude: 80.1918         ),         span: MKCoordinateSpan(             latitudeDelta: 10,             longitudeDelta: 10         )     )     var body: some View {         VStack {             Map(coordinateRegion: $region)             Button("zoom") {                 withAnimation {                     region.span = MKCoordinateSpan(                         latitudeDelta: 100,                         longitudeDelta: 100                     )                 }             }             Button(action: {                 withAnimation {                     region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 51.507222, longitude: -0.1275), span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5))                 }             }) {                 Image(systemName: "location.fill")                     .frame(width: 44, height: 44, alignment: .center)                     .foregroundColor(.black)                 .background(Color(.white))             }.buttonStyle(PlainButtonStyle())             .clipShape(Circle())             .shadow(color: .black.opacity(0.5), radius: 1.0, x: 0.0, y: 2.0)         }     } }
Asked
by Victvs.
Last updated
.