core-location

Location service going to “Inactive” state in iPhone 5

有些话、适合烂在心里 提交于 2019-12-01 11:15:37
Even my app is register for Location updates in background. In my code: self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers; self.locationManager.distanceFilter = 2500; And I not moved anywhere. So after exactly 15 minutes in console log I got this message "Location icon should now be in state 'Inactive'" . From this point onwards my app is not running in background. It's happening in iPhone 5 only. @updated Here is my code self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; [self.locationManager setPurpose:@"Enable Location

Invoke get current coordinates every few seconds without NSTimer

对着背影说爱祢 提交于 2019-12-01 10:41:48
I know how to make this with NSTimer but I wan't to get current iPhone coordinates without timer on every few seconds. I can't use timer because I am getting coordinates while application is in background. I have tried something but this calls every second not every 10 seconds as I wan't. What am I doing wrong here? - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation *loc = [locations objectAtIndex:0]; NSDate* eventDate = loc.timestamp; NSTimeInterval howRecent = [eventDate timeIntervalSinceNow]; if (howRecent < 10) { CLLocation* location =

Send Location of User in Background Swift

╄→гoц情女王★ 提交于 2019-12-01 09:39:13
问题 I am building an app where the user clicks a button and for 60mins (or any amount of time) we keep track of them by uploading their location to a server. Currently we are using 'Did Update Locations' function to send the users location to firebase in real-time. func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { } This system works but it spams the server sending the location of the user to the server once every second. This is too much data and we

Invoke get current coordinates every few seconds without NSTimer

早过忘川 提交于 2019-12-01 08:33:26
问题 I know how to make this with NSTimer but I wan't to get current iPhone coordinates without timer on every few seconds. I can't use timer because I am getting coordinates while application is in background. I have tried something but this calls every second not every 10 seconds as I wan't. What am I doing wrong here? - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { CLLocation *loc = [locations objectAtIndex:0]; NSDate* eventDate = loc.timestamp;

crash on setUserTrackingMode with MKMapView when zoomed in

瘦欲@ 提交于 2019-12-01 08:24:02
I have MKMapView with MKUserTrackingModeFollowWithHeading. But something changes the userTrackingMode to MKUserTrackingModeFollow or None, so I implemented, - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated { if ([CLLocationManager locationServicesEnabled]) { if ([CLLocationManager headingAvailable]) { [self.myMapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO]; }else{ [self.myMapView setUserTrackingMode:MKUserTrackingModeFollow animated:NO]; } }else{ [self.myMapView setUserTrackingMode

crash on setUserTrackingMode with MKMapView when zoomed in

别说谁变了你拦得住时间么 提交于 2019-12-01 07:38:08
问题 I have MKMapView with MKUserTrackingModeFollowWithHeading. But something changes the userTrackingMode to MKUserTrackingModeFollow or None, so I implemented, - (void)mapView:(MKMapView *)mapView didChangeUserTrackingMode:(MKUserTrackingMode)mode animated:(BOOL)animated { if ([CLLocationManager locationServicesEnabled]) { if ([CLLocationManager headingAvailable]) { [self.myMapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO]; }else{ [self.myMapView setUserTrackingMode

Location service going to “Inactive” state in iPhone 5

一笑奈何 提交于 2019-12-01 07:32:42
问题 Even my app is register for Location updates in background. In my code: self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers; self.locationManager.distanceFilter = 2500; And I not moved anywhere. So after exactly 15 minutes in console log I got this message "Location icon should now be in state 'Inactive'" . From this point onwards my app is not running in background. It's happening in iPhone 5 only. @updated Here is my code self.locationManager = [[CLLocationManager

How to trigger a video when a user reaches a certain location?

你说的曾经没有我的故事 提交于 2019-12-01 07:09:26
问题 This is my CoreLocationController.h objective c class #import <Foundation/Foundation.h> #import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h> extern const CLLocationAccuracy kCLLocationAccuracyBest; @protocol CoreLocationControllerDelegate @required - (BOOL)startRegionMonitoring; - (void)locationUpdate:(CLLocation *)location; // Our location updates are sent here - (void)locationError:(NSError *)error; // Any errors are sent here @end @interface CoreLocationController : NSObject

Find the number of routes between two places

拜拜、爱过 提交于 2019-12-01 05:55:20
I need to find out the number of routes from a source to a destination using the Google maps API, and then find, among those, which one is the shortest route. I am able to get one route by using this code -(NSArray*) calculateRoutesFrom:(CLLocationCoordinate2D) f to: (CLLocationCoordinate2D) t { NSString* saddr = [NSString stringWithFormat:@"%f,%f", f.latitude, f.longitude]; NSString* daddr = [NSString stringWithFormat:@"%f,%f", t.latitude, t.longitude]; NSString* apiUrlStr = [NSString stringWithFormat:@"http://maps.google.com/maps?output=dragdir&saddr=%@&daddr=%@", saddr, daddr]; NSURL*

iOS find average speed

筅森魡賤 提交于 2019-12-01 01:31:18
I already have something that shows me my current speed and top speed (max speed in the code below) Now I want to make something that calculates my average speed with core location. How? thanks. - (void)locationUpdate:(CLLocation *)location { speedLabel.text = [NSString stringWithFormat:@"%.2f", [location speed]*2.236936284]; Here is the float for top speed float currentSpeed = [location speed]*2.236936284; if(currentSpeed - maxSpeed >= 0.01){ maxSpeed = currentSpeed; maxspeedlabel.text = [NSString stringWithFormat: @"%.2f", maxSpeed]; } Declare variable is your *.m class @implementation your