cllocationmanager

CLLocation speed return -1.0

社会主义新天地 提交于 2019-12-12 03:52:20
问题 I have problem. My GPS (on iPad mini 2 in Wifi and on iPhone 6 in 3G/4G) the speed return -1.0. Have an idea? This what i receive in console log: Long: 12.5245, Lat: 41.9456, Speed:-1.0, kph: -3.6 Here the code in didUpdateLocations() let userLocation: CLLocation = locations[0] var speed: CLLocationSpeed = CLLocationSpeed() speed = (locationManager.location?.speed)! SpeedLabel.text = String(format: "%.0f km/h", speed * 3.6) let long = String(Float(userLocation.coordinate.longitude)) let lat =

CLLocationManager not stopping/releasing

与世无争的帅哥 提交于 2019-12-12 03:04:12
问题 I'm using MKMapView and I start the map at the last known location with CLLocationManager, the problem is that the iPhone and Location Services reports that I'm still using the services after I'm done which rises some concerns about battery usage. So, please help me release this properly. CLLocationManager * MANG = [[CLLocationManager alloc] init]; [MANG startMonitoringSignificantLocationChanges]; if(MANG.location){ [mapa setCenterCoordinate:MANG.location.coordinate animated:NO]; } [MANG

CLLocationManager stops in background

我们两清 提交于 2019-12-12 02:22:26
问题 I have an app which uses CLLocationManager to track the user's route, drawing dots along the path taken. The app runs in the background using Required background modes > App registers for location updates. As I understand, anything that happens in the background needs to be called from locationManager:didUpdateToLocation:fromLocation as this is the method that gets called with each location update. The problem I'm having is that sometimes this stops getting called. It seems to happen when the

didUpdateToLocation never called

柔情痞子 提交于 2019-12-12 02:13:02
问题 I am using both the simulator and my device to test this, but no matter what I do, didUpdateToLocation is never called. I have tried changing my location in the sim, turning off and then on again my location services on my phone to force the phone to search for a new location... nothing. In my viewDidLoad(), I have started the CLLocationManager as so: CLLocationManager *manager = [[CLLocationManager alloc] init]; if (![CLLocationManager locationServicesEnabled]) { UIAlertView

How to calculate speed using accelerometer in ios

风格不统一 提交于 2019-12-12 02:07:36
问题 I want to implement a functionality to calculate the speed of moving object, but I don't want to use GPS (CLLocationManager ). Any suggestions on other ways to calculate speed? 回答1: I want to implement a functionality to calculate speed of moving object, but I don't want to using GPS(CLLocation). An object traveling at constant velocity doesn't experience any forces for the accelerometer to measure, so the accelerometer alone isn't enough to determine velocity -- you can only measure changes

Location alerts using Core Data to get around CLRegion 20 region cap

こ雲淡風輕ζ 提交于 2019-12-12 01:47:49
问题 I have an app that stores points of interest (POIs) in a Core Data managedObjectContext . My objective is to have alerts go off if currentLocation is within a specified range of a POI in the managedObjectContext . In reading about CLRegion , it seems the amount of regions that can be monitored is capped at 20. To get around the region monitoring cap, my game plan is to skim my managedObjectContext for latitude/longitude coordinates and compute distances between POIs every time my location

Location manager accuracy not very accurate

孤街浪徒 提交于 2019-12-12 01:47:48
问题 I am having an issue with sending location to other users. I using Parse.com as my backend and I use this code to get a location: -(void)sendLocation{ if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]){ [locationManager requestWhenInUseAuthorization]; } [locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { [locationManager

Location Services not working in iOS 8

拜拜、爱过 提交于 2019-12-12 00:35:03
问题 My app that worked fine on iOS 7 doesn't work with the iOS 8 SDK. CLLocationManager doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What could be wrong? 回答1: I ended up solving my own problem. Apparently in iOS 8 SDK, requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (location only when foreground) call on CLLocationManager is needed before starting

Set delegate of CLLocationManager (Two different ways, are they equal?)

拜拜、爱过 提交于 2019-12-11 19:56:42
问题 Working on a tutorial with CLLocationManager where I set the delegate within the init method: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager startUpdatingLocation]; } return self; } Set the delegate:

can't Find location within milesof using stackmob as backend

孤街醉人 提交于 2019-12-11 17:58:51
问题 I am trying to find the locations, but I am getting a empty array returned. It succeeded, but got nothing back. In the object brower, i can say there are values in the "location". I have saved several locations using my current location. Will this work? - (void)geoQuery { MKCoordinateRegion region; region = MKCoordinateRegionMakeWithDistance(locationController.locationManager.location.coordinate, 5000, 5000); [self.mapView setRegion:region animated:YES]; SMQuery *query = [[SMQuery alloc]