core-location

How to get Current Location using SwiftUI, without ViewControllers?

こ雲淡風輕ζ 提交于 2020-08-20 18:07:25
问题 I've prepared in my project the following class to retrieve the user current location: LocationManager.swift import Foundation import CoreLocation class LocationManager: NSObject { // - Private private let locationManager = CLLocationManager() // - API public var exposedLocation: CLLocation? { return self.locationManager.location } override init() { super.init() self.locationManager.delegate = self self.locationManager.desiredAccuracy = kCLLocationAccuracyBest self.locationManager

CLLocationManager.requestLocation() takes about 10 seconds

随声附和 提交于 2020-05-11 04:33:07
问题 CLLocationManager.requestLocation() takes around 10 seconds to fire didUpdateLocations event. Here are the attributes set for the CLLocationManager let locationManager = CLLocationManager() locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.distanceFilter = 10 locationManager.requestWhenInUseAuthorization() locationManager.requestLocation() As per the documentation this can take several seconds. This method returns immediately. Calling it

CLLocationManager.requestLocation() takes about 10 seconds

蹲街弑〆低调 提交于 2020-05-11 04:32:19
问题 CLLocationManager.requestLocation() takes around 10 seconds to fire didUpdateLocations event. Here are the attributes set for the CLLocationManager let locationManager = CLLocationManager() locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.distanceFilter = 10 locationManager.requestWhenInUseAuthorization() locationManager.requestLocation() As per the documentation this can take several seconds. This method returns immediately. Calling it

SWIFT: CoreLocation - Ranging Beacons using CLBeaconIdentityConstraint does not range multiple beacons

僤鯓⒐⒋嵵緔 提交于 2020-04-16 02:59:29
问题 So, we have encountered a problem, developing in Swift for iOS 13. When we use the newer method for ranging beacons "startRangingBeacons(satisfying: CLBeaconIdentityConstraint )" it will only range the most recently added beacon, so if there are more than one beacon, we have a problem. When we use the older method, "startRangingBeacons(in: region)," now deprecated but still functional in iOS 13, the app works as expected. Details (using the newer method with "constraints"): App

Handle SwiftUI and CoreLocation with MVVM-Pattern

心不动则不痛 提交于 2020-02-22 05:39:28
问题 i am trying to implement SwiftUI and CoreLocation with the MVVM-Pattern . My LocationManager as Helper works fine. But how I can change the properties of my LocationViewModel ? I am implemented my @ObservedObject of the LocationManager in LocationViewModel . Here is my problem. I don't have a idea to implement properties they change on the fly. Nothing is changed in my LocationView. By pressing a Button anything works fine one time. But the LocationViewModel must change there properties on

Get Location Updates for iOS App Even when Suspended

两盒软妹~` 提交于 2020-02-08 16:14:23
问题 On early 2014, Apple has updated the iOS 7.0 to 7.1 in order to allow location updates even when the app is not active on foreground and not in the background. How do we do that? I have read some articles like Apple's iOS 7.1 will fix a geolocation bug. But Apple didn't provide much communication related to that nor any sample code on how to get the location update even when the app is killed/terminated/suspended. I have read the Release Notes for iOS 7.1. I couldn't find anything related to

Get Location Updates for iOS App Even when Suspended

牧云@^-^@ 提交于 2020-02-08 16:13:07
问题 On early 2014, Apple has updated the iOS 7.0 to 7.1 in order to allow location updates even when the app is not active on foreground and not in the background. How do we do that? I have read some articles like Apple's iOS 7.1 will fix a geolocation bug. But Apple didn't provide much communication related to that nor any sample code on how to get the location update even when the app is killed/terminated/suspended. I have read the Release Notes for iOS 7.1. I couldn't find anything related to

Get Location Updates for iOS App Even when Suspended

半城伤御伤魂 提交于 2020-02-08 16:13:07
问题 On early 2014, Apple has updated the iOS 7.0 to 7.1 in order to allow location updates even when the app is not active on foreground and not in the background. How do we do that? I have read some articles like Apple's iOS 7.1 will fix a geolocation bug. But Apple didn't provide much communication related to that nor any sample code on how to get the location update even when the app is killed/terminated/suspended. I have read the Release Notes for iOS 7.1. I couldn't find anything related to

testing GPS in iPhone simulator problem

拈花ヽ惹草 提交于 2020-02-07 04:57:25
问题 I found some various articles about testing the GPS (corelocation) in the iPhone simulator. It seems pretty straightforward, but i can't get it to work. The error message i'am getting is: 2010-07-30 11:20:16.372 appname[50954:207] *** +[CLLocation initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:]: unrecognized selector sent to class 0x32081320 2010-07-30 11:20:16.373 appname[50954:207] CoreAnimation: ignoring exception: *** +[CLLocation initWithCoordinate:altitude

allowDeferredLocationsUpdates working on the simulator but not on my iPhone 6s

筅森魡賤 提交于 2020-02-03 10:47:51
问题 I'm trying to understand the deferredLocations feature. As per apple docs, the following should work, and it does when I run it on the simulator, but once I install the app on my iPhone 6s and disconnect the iPhone and run the app, the locations updates do not get deferred. I'm using XCode 8 and swift 3. Here is the code: override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. locationManager=CLLocationManager()