cllocationmanager

Background location tracking not working on physical device swift

橙三吉。 提交于 2019-12-06 12:20:44
问题 I followed this tutorial (https://www.raywenderlich.com/92428/background-modes-ios-swift-tutorial) to create an app that maps the user's location in the background. It asks to follow the user's location even when the app is closed, the user presses yes, and it tracks location in the background, updating every second or so. It works perfectly in the simulator, but sideloaded onto a physical iPhone 6, it stops checking the user's location in the background. 回答1: I solved this. If your

how is it that CLLocationManager gets a location when Airplane Mode is ON

梦想的初衷 提交于 2019-12-06 11:16:08
My app uses CLLocationManager to get location updates from the device. I had assumed that when the device was in Airplane Mode, I would not get location updates. But I do. The reason I assumed this is because Apple says that Airplane mode turns off Wifi, Cellular, Bluetooth, and GPS. See: http://support.apple.com/kb/ht1355 So, how is it that I'm getting a location update with a coordinate that seems reasonable? I've developed an app that heavily uses the user location, so I had to check this and other situations. I've learned that when all the services are off (Bluetooth, Wi-Fi, Cell Data)

How to get location in background even after phone restart in swift?

蓝咒 提交于 2019-12-06 11:10:47
问题 I'm developing an application which is tracking the location of the phone on time interval chosen by the user. I made it with timer which starts startUpdatingLocation , when it get the location stops updating sends the location to the server and starts timer again. Everything is done in background. I need to get location data in background mode (in iOS 8) even after phone restarts and send the data to a server. I tried hundreds methods and no one works for me. So ... what i've got at this

iPhone Brainstorm - CLLocation in Background - Polling every 15 minutes

荒凉一梦 提交于 2019-12-06 10:47:36
问题 Here is the scenario. I need to have an application which polls a web service with the users location every 15 minutes whether in background / foreground. At the moment I: Start / Restart the location manager with accuracy highest and distance filter none. Wait to get within desired accurancy. Store reading setDesiredAccuracy to be: "kCLLocationAccuracyThreeKilometers" setDistanceFilter to be: 1000 Set a performSelector:@selector(getLocation) withObject:nil afterDelay:900 Start again from

Location timestamp accuracy in ios

一个人想着一个人 提交于 2019-12-06 10:24:40
After analysing location services in iOS 10, found that some inconsistency is in the caching behaviour. Fetching locations in a periodic time (in my case every 20 secs) returns locations but their timestamps are not in chronologically ordered. This indicates that the caching locations might have issues. So if you are checking accuracy through location-timestamp better to save the previous timestamps also. So that you could decide that the location fetched can be used or not. Below image is taken from my console log. Here I used the format "Lat Long : latitude_longitude | location_timestamp |

Find closest longitude and latitude in array from user location

不羁岁月 提交于 2019-12-06 09:11:43
I have an array full of longitudes and latitudes. I have two double variables with my users location. I'd like to test the distance between my user's locations against my array to see which location is the closest. How do I do this? This will get the distance between 2 location but stuggeling to understand how I'd test it against an array of locations. CLLocation *startLocation = [[CLLocation alloc] initWithLatitude:userlatitude longitude:userlongitude]; CLLocation *endLocation = [[CLLocation alloc] initWithLatitude:annotation.coordinate.latitude longitude:annotation.coordinate.longitude];

iPhone: maximumElapsedTimeForCachedLocation used to remove cache value of core location

我是研究僧i 提交于 2019-12-06 08:44:39
In certain cases, cached values are immediately returned when starting a location service. Any location with a time interval older than this value will be considered invalid. @property (nonatomic, assign) NSTimeInterval maximumElapsedTimeForCachedLocation Declared In UABaseLocationProvider.h Do any of you know how to use this maximumElapsedTimeForCachedLocation in Core Location for removing the cache value of the old location? 来源: https://stackoverflow.com/questions/12909910/iphone-maximumelapsedtimeforcachedlocation-used-to-remove-cache-value-of-core-l

Swift: Geofencing / geolocations near user location

安稳与你 提交于 2019-12-06 07:24:08
问题 Problem: I'm trying to make it so that it uses the user's location all the time and constantly checks to see if it is within 5 miles of the CLLocationCoordinate2D points I have set. If so, it sends a alert if the app is open or a notification if the app is closed. Useful Information: In my project I have 4 swift files: Locations.swift holds the CLLocationCoordinate2D points. Utilities.swift holds a simple alert. UserLocation.swift retrieves and updates the user's location

Move and Rotate GMSMarker smoothly along last updated GPS coordinates Swift iOS

半腔热情 提交于 2019-12-06 06:53:05
I'm using GMSMapView . So I added custom GMSMarker and set the image(Ex. Bike image) and animating that marker when user starts moving and changing the angle of the marker in locationManager . Currently I'm just updating position attribute of GMSMarker. But it gives the GMSMarker jump effect. Instead of this I want to move and rotate the GMSMarker smoothly/properly into the GMSMapView. How can i achieve this in Swift? Thanks. (void)updateLocationoordinates(CLLocationCoordinate2D) coordinates { if (marker == nil) { marker = [GMSMarker markerWithPosition:coordinates]; marker.icon = [UIImage

didUpdateToLocation is not called

橙三吉。 提交于 2019-12-06 06:09:16
I want to receive location updates. I have added a location delegate to the header: @interface AppDelegate : UIResponder <UIApplicationDelegate, CLLocationManagerDelegate> and the following functions: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //initialize location manager CLLocationManager* locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; // [locationManager startMonitoringSignificantLocationChanges]; [locationManager startUpdatingLocation]; self.window = [[UIWindow alloc] initWithFrame:[