cllocationmanager

CLLocationManager geo-fencing/startMonitoringForRegion: vs. startMonitoringForSignificantLocationChanges: vs. 10-minute startUpdating calls

人盡茶涼 提交于 2019-11-29 00:07:53
问题 I am trying to set up an app that will be able to check people's locations in the background, see if they are at a given location, and send a ping to a server if they are. We do not want to drain the energy of our users, so we are attempting to figure out the best solution. I've done substantial reading and I have not found very much information on these methods. I'll go through the pros and cons as I understand them right now startMonitoringForSignificantChanges Description: Based off of wi

Locationservice Indicator stays “on”

我的梦境 提交于 2019-11-28 23:53:37
I have a created a small app which uses location services on the iPhone. All works well, except the fact, that sometimes, the small arrow in the info-bar stays active even if I explicitly kill the app. I use the background mode for locationservices, thus the appDelegate methods applicationWillResignActive , applicationDidEnterBackground , applicationWillEnterForeground and applicationDidBecomeActive are implemented but do not touch the location services (well - I need them in background mode). In that configuration applicationWillTerminate is never called; I implemented all the cleanup cleanup

UIBackgroundModes location and significant location changes with region monitoring

…衆ロ難τιáo~ 提交于 2019-11-28 22:48:37
问题 I have an app that uses a combination of startMonitoringForRegion: and startMonitoringSignificantLocationChanges to keep aware of where the user is when the app is in the background. Does this mean that I need to include the location value for the UIBackgroundModes key in the Info.plist ? This is a quote from the docs: The significant-change location service is highly recommended for apps that do not need high-precision location data. With this service, location updates are generated only

MKMapView and CLLocationManager

我们两清 提交于 2019-11-28 21:23:28
I want to use a MKMapView to display the user current location using the default breathing blue pin and I want to record the user movement at the same time. Is there any way that I could use the GPS manager (not sure if this is a CLLocationManager) the MKMapView uses when we enabled it to show user location? I know that I can create my own CLLocationManager. But this feels like adding an overhead to my application and I would like the map and my tracking to remain in sync. I already explored the following ideas without success: Use the [MKMapView showUserLocation:YES] and add KVO on the

CLLocationManager on iPhone Simulator fails with kCLErrorDomain Code=0

[亡魂溺海] 提交于 2019-11-28 21:03:34
CLLocationManager on iPhone Simulator is supposed to fake Cupertino (isn't it?) but it does NOT, it fails with kCLErrorDomain Code=0 instead. LocationManager's delegate receives the message didFailWithError . This method is implemented to log the error and the console outputs the following: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)" I was working on a real project when I ran into this problem but it is pointless to discuss my code because I downloaded "Locations" sample code (updated 2010-06-22 for iOS 4) from the dev center and the

Location tracking stops after a while when app is in the background

爷,独闯天下 提交于 2019-11-28 20:12:15
问题 I've created a simple app which tracks user location and creates local notification for every time location is updated. I enabled the background modes below, let locationManager = CLLocationManager() open override func viewDidLoad() { locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; locationManager.distanceFilter = 10 locationManager.allowsBackgroundLocationUpdates = true locationManager.startUpdatingLocation() } open func locationManager(_ manager:

How to handle “Don't Allow” for location manager?

大城市里の小女人 提交于 2019-11-28 18:49:30
I haven't think of this yet now . Till now whenever device was asking me use location update I was allowing it . But when now I am not allowing then it the location manager gives me kclErrorDenied and the location manager can not start again until I restart the application . So my question is that should I give a message to restart the app to the user or is there a solution to start working the location manager again . thanks . The Error : ERROR,Time,288787555.078,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, const CLDaemonCommToClientRegistration*, const __CFDictionary*)"

ios, startMonitoringSignificantLocationChanges - sometimes breaks monitoring

与世无争的帅哥 提交于 2019-11-28 18:03:32
I have strange problem with updating user's location. Sometimes my app updates location but from time to time breaks updating. I do not know where is problem, my code (from AppDelegate.m) is below: - (void)applicationDidEnterBackground:(UIApplication *)application { NSLog(@"Went to Background"); // Only monitor significant changes [locationManager startMonitoringSignificantLocationChanges]; } - (void)applicationDidBecomeActive:(UIApplication *)application { // Start location services locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyBest;

How to check if MKCoordinateRegion contains CLLocationCoordinate2D without using MKMapView?

六眼飞鱼酱① 提交于 2019-11-28 17:36:42
I need to check if user location belongs to the MKCoordinateRegion. I was surprised not to find simple function for this, something like: CGRectContainsCGPoint(rect, point) . I found following piece of code: CLLocationCoordinate2D topLeftCoordinate = CLLocationCoordinate2DMake(region.center.latitude + (region.span.latitudeDelta/2.0), region.center.longitude - (region.span.longitudeDelta/2.0)); CLLocationCoordinate2D bottomRightCoordinate = CLLocationCoordinate2DMake(region.center.latitude - (region.span.latitudeDelta/2.0), region.center.longitude + (region.span.longitudeDelta/2.0)); if

Why is my CLLocationmanager delegate not getting called?

此生再无相见时 提交于 2019-11-28 17:35:19
I'm not getting any location callbacks on either sim or device. I've got this code being called: - (void)startLocationCallbacks: (NSObject*) ignore { locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; locationManager.distanceFilter = MINIMUM_METERS; [locationManager startUpdatingLocation]; NSLog(@"[DEBUG] [locationManager startUpdatingLocation] (%@, %@)", locationManager, locationManager.delegate); } and log statements at the top of both - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error and - (void