cllocationmanager

Background user location when app is terminated/suspended

梦想的初衷 提交于 2019-11-28 07:18:49
I've been trying to figure out how to get the user's location when the app is terminated like how the app Moves does it. The only way I know of doing so is with Significant Location Changes. However with significant location changes, the app only gets woken up either every 500 meters and only if it has been around 5 minutes past the last update. According to Apple: Apps can expect a notification as soon as the device moves 500 meters or more from its previous notification. It should not expect notifications more frequently than once every five minutes. If the device is able to retrieve data

iOS 8 MKMapView User Location Request Failure

荒凉一梦 提交于 2019-11-28 05:53:10
问题 I have been trying to move my iOS7 app with MKMapview to support iOS8. However I couldn't get the new request for users to share their locations to work properly. I create my MKMapView on a storyboard and the delegate is set and works perfectly on iOS7. Here is what I've added to support iOS8 Location sharing: myMapView.h #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> #import <CoreLocation/CoreLocation.h> @interface myMapView : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate

Corelocation incorrect distances

折月煮酒 提交于 2019-11-28 04:33:45
问题 I am developing an application which computes the distance traveled by the user. I am using CLLocationManager class to do so, but I am getting the cached data initially and also the distance variable is increasing at a sudden rate. Please help me out... I have used the following code.... Note:distance is a static var. here - (void)viewDidLoad { [super viewDidLoad]; //bestEffortAtLocation = nil; oldLocat = [[CLLocation alloc]init]; newLocat = [[CLLocation alloc]init]; locationManager =[

CLLocationManager startUpdatingLocation not working

微笑、不失礼 提交于 2019-11-28 03:30:06
问题 So now I'm at least getting callbacks with the following code... - (void)viewDidLoad { [super viewDidLoad]; mapView=[[MKMapView alloc] initWithFrame:self.view.frame]; //mapView.showsUserLocation=TRUE; mapView.delegate=self; [self.view insertSubview:mapView atIndex:0]; NSLog(@"locationServicesEnabled: %@", [CLLocationManager locationServicesEnabled] ? @"YES":@"NO"); CLLocationManager *newLocationManager = [[CLLocationManager alloc] init]; [newLocationManager setDesiredAccuracy

CLLocationManager and accuracy issues - any experiences?

ε祈祈猫儿з 提交于 2019-11-28 03:12:44
So I am dealing with some accuracy issues with iPhone GPS. I have an app which uses location. In the delegate method locationManager: didUpdateToLocation: fromLocation: I am being returned a location. From a bit of research, it appears the GPS isn't always accurate on the first result it returns, even when setting desiredAccuracy property to kCLLocationAccuracyBest . In order to get around this, I don't call stopUpdatingLocation before it's returned newLocation: at least 3 times (this is very quick). I have also played around with two other "requirements" for whether to stopUpdatingLocation

Checking location service permission on iOS

99封情书 提交于 2019-11-28 03:08:28
How can I check if location service is enabled for my app? I have 2 storyboards and I want to check location service. If location service enabled for my app, I want to launch map storyboard with location. Otherwise, I want to launch another storyboard. How can I do programmatically? Melih Mucuk This is the correct. if ([CLLocationManager locationServicesEnabled]){ NSLog(@"Location Services Enabled"); if ([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){ alert = [[UIAlertView alloc] initWithTitle:@"App Permission Denied" message:@"To re-enable, please go to Settings and

How to set accuracy and distance filter when using MKMapView

倖福魔咒の 提交于 2019-11-28 02:59:30
When i use setShowsUserLocation with MKMapView to track user location, how do I set the accuracy and distance filter? I am not talking about CLLocationManager . Thanks, Jano You can't control the accuracy of the internal MKMapView location manager (the one used to track the user with the blue dot), but you can create your own and use it to recenter the map. Here is a recipe... To handle core location permissions In the Core Location Delegate: - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { if ([CLLocationManager authorizationStatus] ==

Cannot get rid of Optional() string

寵の児 提交于 2019-11-28 02:14:36
I am trying to update users location on server Using this function func updateloc(lat : String?, long : String?) { /code... let data = "lat=\(lat!)&long=\(long!)" } And here is the delegate func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { updateloc(String(manager.location?.coordinate.latitude), long: String(manager.location?.coordinate.longitude)) } I have Optional("") for lat and long variables and cannot get rid of it. Any idea how to do that? If you unwrap the latitude and longitude values like this... func locationManager(manager:

Location service iOS alert call back

不打扰是莪最后的温柔 提交于 2019-11-28 00:41:34
问题 When we use location services in an application, we receive an iOS alert saying the application is trying to use the current location -- Allow/Don't Allow. Do we have a delegate call back for these buttons? I want to handle tap on "Don't Allow". 回答1: You don't have direct access to that alert. If the user presses "Don't Allow", or if the app otherwise doesn't have permission to use location services then CLLocationManager will call locationManager:didFailWithError: on its delegate. The error

Location Manager update frequency, iphone

霸气de小男生 提交于 2019-11-27 23:42:33
I have a CLLocation manager called "myLocation". myLocation = [[CLLocationManager alloc] init]; myLocation.desiredAccuracy = kCLLocationAccuracyBestForNavigation ; myLocation.distanceFilter = 10 ; myLocation.delegate=self; locationEnabledBool = [CLLocationManager locationServicesEnabled]; if (locationEnabledBool ==NO || ( [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied)) { // LocationText.text = @"Location Service Disabled "; UIAlertView *locationAlert = [[UIAlertView alloc] initWithTitle:@"Location Service Disabled" message:@"To re-enable, please go to Settings and