Questions tagged [cllocationmanager]
The CLLocationManager class defines the interface for configuring the delivery of location- and heading-related events to your application
2,738
questions
0
votes
1
answer
30
views
SwiftUI - Show predefined location as a user location on map
I am building an app that relies significantly on the user's location.
When the app starts, the user is presented with a series of views (on-boarding), and on the last view there are the following ...
-5
votes
0
answers
35
views
How to fetch location constantly through out all views, even if entering the same view again?
So my problem here is that i want the app to get and update the location at all times even if the user is inside the app scrolling through multiple views and if the app is in background too. I figured ...
-1
votes
1
answer
44
views
Why is my CLLocationManager sometimes updating location twice after startUpdatingLocation is called
Once a button is pressed, I have a CLLocationManager that requests authorization for location services and if the user accepts, the locationManager will call startUpdatingLocation(). Once there is an ...
0
votes
0
answers
52
views
LocationManager gets called multiple times on app startup
So I am dealing with an issue where the LocationManager file that I have, and the didUpdateLocations function, is being called multiple times on application startup and I can't figure out what is ...
1
vote
2
answers
77
views
Objective C - How to call UI-process from non-UI class
I'm trying to get the user position in iOS.
I guess the problem could be related to the dispatch_async.
I don't get errors during compilation but only the init function is called and the ...
0
votes
0
answers
18
views
Why does my compiler in swift jump around in the function? [duplicate]
I copied a Swift-func last week out of the internet Link. The function should convert 2 CLLocationDegrees (latitude and longitude) into an address. From the address I only need the postal code. The ...
1
vote
2
answers
109
views
Swift warning making UI unresponsive
I am using swift version 5.7.1 and Xcode 14.1 . I am creating Map Application with user location and it working fine .. But here is the problem , it giving warning ..
This method can cause UI ...
1
vote
1
answer
39
views
"Delegate must respond to locationManager:didUpdateLocations:" error thrown when app does handle it
Right now I am just trying to get the location printed on screen, and will expand upon it later, but I am getting the following console output (the app also crashes - it is being built and run on a ...
0
votes
1
answer
407
views
How should CLLocationManager status be checked in locationManagerDidChangeAuthorization before loading an iOS view?
Since iOS 16/Xcode 14, I get this error:
This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and ...
2
votes
1
answer
805
views
Why is iOS 16/Xcode 14 causing UI responsiveness issues for apps that use location services and adMob?
I get this error:
This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking ...
1
vote
0
answers
124
views
CLLocationManager - iOS native module for background location updates causing 100% battery usage
I have created an iOS native module for my React Native application, which invokes the location manager service on iOS.
The purpose of the app is to automatically detect when a user is driving in a ...
0
votes
0
answers
32
views
iOS Mapkit Annotation Pin Shrinking
MapView is pin skrinking everytime. I'm using MKAnnotationView. Can anyone tell what what am I missing here why the pin shrinking? I want to show the pin like that star icon which is also annotation.
...
0
votes
1
answer
37
views
Catch every moment when user change his location
I am using Google Map SDK. I want to catch every moment when user changes his location, maybe from CLLocationManagerDelegate. Can anyone say which method can execute previous job?
I tried to use ...
0
votes
0
answers
29
views
How can there be duplicate method declarations in CLLocationManagerDelegate for locationManager?
I am new to Swift and working through an online iOS development bootcamp course and the course has introduced the delegate design pattern. The course earlier demonstrated the design pattern via the ...
0
votes
1
answer
197
views
Current Location is Nil In SwiftUI
I am getting user's current location in my SwiftUI app. To get the latitude and longitude, I am using following code onAppear() of my view:
let locManager = CLLocationManager()
...
-1
votes
2
answers
86
views
How to show in which side user turn phone, if I show user location using MKMapView
I want to show into which side the user turns the phone, like on MapView, and can't understand how to do that, I have tried to use these options, but they can't help me:
mapView.showsUserLocation = ...
1
vote
1
answer
306
views
Automatically include user’s current location in a SMS (Swift)
I'm trying to build a simple app for with a feature that will allow a user to send an sms that automatically includes their location. I have found some code for it however they’re either old or is ...
1
vote
1
answer
63
views
In what scenarios would CLLocationManager return a current location array with more than one entry?
Background
According to the documentation for the delegate method locationManager(manager:locations:)
Parameter: locations [CLLocation]
An array of CLLocation objects containing the location data. ...
0
votes
1
answer
119
views
Swift, ClLocationManager slow to fire didEnterRegion
I am trying to implement directions with clLocationManager in a project.
Everything is working ok, but the didEnterrRegion function is very slow to fire.
When testing, I enter the region but only 2-3 ...
1
vote
1
answer
103
views
locationManager(_:didUpdateLocations:) last entry is sometimes extremely outdated
According to Apple's own documentation around CLLocationManager
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
locations.last // this is supposed ...
0
votes
0
answers
72
views
requestAlwaysAuthorization not have effect after chose "allow once"
My app has 2 levels local request authorization. First i call requestWhenInUseAuthorization and then requestAlwaysAuthorization. But if a user chose "allow once" I see authorization as ...
1
vote
0
answers
328
views
Swift UI - User Location is not centered on mapkit, resizing Map jumps back to location
I want to build a map which shows the user location, the zoom scale and can be switched between standard maptype and hybrid maptype.
For testing reasons, I didn't integrate the mapstyle-picker yet. I ...
0
votes
1
answer
108
views
locationManager.startUpdatingLocation gets executed too late
I am trying to get my user's current location using a closure, but it returns a nil value because the locationManager.startUpdatingLocation() sets the value after the closure has returned the (nil) ...
0
votes
0
answers
114
views
How to retrieve current user location title when clicking button
I am new to using MapKit and CoreLocation, my question is how do I get ahold of the user location title when clicking button that I have added in my fist view section. I have added locationManager....
0
votes
0
answers
244
views
Best Practice way to handle locationAlways permission request in iOS
How are we supposed to handle, when a user denies the permission request for kCLAuthorizationStatusAuthorizedAlways ? As i understand it, we don't get a direct response to requestAlwaysAuthorization, ...
0
votes
0
answers
17
views
distanceFilter property of CLLocationManager is not working properly for 50 meter with kCLLocationAccuracyNearestTenMeters
distanceFilter property of CLLocationManager is not works for 50 meter with kCLLocationAccuracyNearestTenMeters, but its works for 10 meter with kCLLocationAccuracyNearestTenMeters and also works for ...
0
votes
0
answers
41
views
Location Manager stops updating Location in the background
I am working on an app that requires location to work in the background constantly. I am using CLLocationManager.
Whats happening is after sometime the location service stops working in the background....
0
votes
1
answer
524
views
Google Maps iOS SDK to user's current location on launch Swift SwiftUI
I'm trying to mimic some functionality of Google Maps, where upon launching the app, the camera is moved to the current location of the user, provided the required perms have been granted.
I have ...
0
votes
1
answer
257
views
How to detect when a Beacon is no longer detected by an iOS device?
I am running into an issue when ranging beacons using LocationManager.startRangingBeacons method.
When ranging for Beacons, the Apple documentation clearly states that locationManager(_:didRange:...
0
votes
0
answers
110
views
How can I convert distance from one location to another in miles swift?
I have 2 coordinates - coordinate consisting of long and lat which is one location and coordinate b which is another location. How do I correctly convert to two distances into miles - for example, I ...
0
votes
1
answer
125
views
Does reverseGeocodeLocation(_ location: CLLocation) method works in offline mode?
I'm getting a location name from the method reverseGeocodeLocation(_ location: CLLocation). My requirement is along with storing Lat-Long values in DB in offline mode, I also want to store this ...
0
votes
0
answers
42
views
App Asks for Location Right After First Launch
I have an app that uses location services.
On the first launch, I want the user to press the button to turn the location services on (which brings up the system dialog asking for the location ...
0
votes
1
answer
493
views
How to update my location Custom Marker with googleMaps in Swift
I am currently trying to create a method to change the blue dot of googlemaps with a custom Icon, but currently I have the problem that the marker prints but don't clear its last location, this is the ...
0
votes
0
answers
66
views
Is this Swift code a race condition or is it executing correctly?
So, I have a post request in my app which relies on the user latitude and longitude already having a value (0,0 is the default for lat,lon so anything EXCEPT this). I run the post request in my ...
0
votes
0
answers
100
views
Swift: getting user location based on geoJSON
Given a geoJSON representation of each US state (such as found here), along with user location coordinates (as available via CLLocationManager), what would be the best way to identify which state is ...
-1
votes
1
answer
83
views
CLLocationManager suddenly only returning New York, NY on Device?
This code has always worked reliably but lately (at least on my Watch) it's always returning New York, New York no matter where I am? Did something change in Core Location? 🤔
import CoreLocation
...
0
votes
1
answer
402
views
Execute DidRangeBeacons all the time in iOS 15 when user is in the range of beacon
[Expected behaviour: Specifically for iOS 15. iOS 14 or lower versions work fine]
I have an Xamarin.Forms iOS app where I am monitoring and ranging for BLE beacons. The goal is that being in ...
0
votes
0
answers
68
views
LocationManager does not return coordinates
I have location manager configured similar to how this post described How to get Current Location using SwiftUI, without ViewControllers? and I can see in the console that the lat and long are being ...
0
votes
2
answers
178
views
Error: GeoPoint long and lat is nil not allowing me to send coordinates due to Unwrapping Optional Value
Hello I am stuck and have tried to google and research but am not having any luck. The user location is saying its nil. I am trying to send it to Firebase database to show the users location. When I ...
2
votes
0
answers
176
views
How to prevent auto-zooming with IOS MapKit when using userTrackingMode = .followWithHeading? (using SwiftUI)
How can one prevent auto-zooming with IOS MapKit when using userTrackingMode = .followWithHeading? That is I am setting the current user location to the centre of the screen, and have "view....
0
votes
1
answer
597
views
SwiftUI MapKit use of coordinator - how to access map "view" to adjust visible area in "didUpdateLocations"?
I am using the SwiftUI MapKit and the coordinator approach to gain more functionality. I am not sure how to change the visible area the map displays from the "didUpdateLocations" delegate ...
0
votes
1
answer
32
views
CLLocationManager authorization callbacks (when no auth-change)
My app needs always-authorization.
Apple states that if an app already has "WhenInUse" authorization, it may ask exactly once for "Always".
So the following workflow pops up:
Ask ...
0
votes
1
answer
133
views
SwiftUI 3.0 XCode13 B3 Executing the LocationButton will result in Error Domain=kCLErrorDomain Code=1 "(null)
When I run LocationButton on B3 simulator of XCode13, I get Error Domain=kCLErrorDomain Code=1 "(null)
When the button is pressed
Detecting errors with delegate func locationManager(_ manager: ...
0
votes
2
answers
754
views
How can I initialize a State Var in Swift UI without getting the error "Cannot use instance member 'XXX' within property initializer;"
I am looking to put a users location on a MapView and have the location update as the user moves. I am using an @observedObject Var for the class handling the location manager stuff and a @state Var ...
0
votes
1
answer
432
views
LaunchOptions.locationKey in UIApplication didFinishLaunchingWithOptions nil
I'm monitoring significant location updates via CLLocationManager. When the app is killed and there is a location event, both App Delegate and Scene Delegate are being launched in the background ...
1
vote
0
answers
93
views
Why I can't detect ANY iBeacons using Swift while Objective C can?
So, I've been working to detect available iBeacons in my office. I surfed the internet and always found a solution where you NEED to know the UUID of the iBeacons in order to detect it. However, I ...
0
votes
3
answers
389
views
Updating location to server every X minutes iOS
I am trying to update location from app to firebase after every X minutes ( any value less than 15mins is good).
I have enabled background mode for location and in following method I try to upload to ...
0
votes
1
answer
431
views
Using startUpdatingLocation() and stopUpdatingLocation() to activate/deactivate location updates in specific Views
Based on some code examples from stackoverflow I created a class for location service. The location service is started immediately when the app starts, indicated by the navigation symbol in the upper ...
0
votes
1
answer
122
views
CLLocationManager.desiredAccuracy with kCLLocationAccuracyBestForNavigation will sometimes snap to roads
I added a GPS tracker to my iOS app (POI Toolbox). Now the kCLLocationAccuracyBestForNavigation setting seems to make the CLLocationManager assume I am moving on a road when there is one nearby. ...
-1
votes
1
answer
36
views
Why is CLLocationManager class a part of MapKit?
I only imported MapKit and UIKit. Then in my Code I used the class CLLocationManager
var locMgr = CLLocationManager()
My Code works without any error.
But there is something wierd.
CLLocationManager ...