cllocationmanager

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

落爺英雄遲暮 提交于 2019-11-29 23:03:13
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: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let notification = UILocalNotification

Checking for iOS Location Services

こ雲淡風輕ζ 提交于 2019-11-29 20:38:57
I have a view with a map and a button (like the Maps app once) that allows the user to center and zoom his current location on the map. If I can not use the locationServicesEnabled method (always returns YES), should I create a BOOL attribute to check if the didFailWithError method is called and know if I can call the button method? Thanks for reading. Edited: This code does not work for me. I am using the simulator. I am always getting YES when asking locationServicesEnabled. // Gets the user present location. - (IBAction)locateUser:(id)sender { if([CLLocationManager locationServicesEnabled])

startMonitoringSignificantLocationChanges not working in swift

折月煮酒 提交于 2019-11-29 19:52:07
问题 I'd added CLLocationManager in my app using Swift in the AppDelegate file. In the Appdelegate.swift file, import CoreLocation @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate { var locationManager: CLLocationManager! In the didbecomeActive method: func applicationDidBecomeActive(application: UIApplication) { if((locationManager) != nil) { locationManager.stopMonitoringSignificantLocationChanges() locationManager.delegate = nil locationManager

How Can I Get Current Location on iOS? [duplicate]

耗尽温柔 提交于 2019-11-29 18:14:50
This question already has an answer here: how to get the current location position in map on iphone 2 answers I can't get current location. When I launch my app in different place, App can get last location. But I don't want to last location. If you close the app and restart it, now app can get current location. How can I get current location even if it is first launch of application? - (void)viewDidLoad { [super viewDidLoad]; [locationManager startUpdatingLocation]; self.mapView.delegate = self; [self.mapView setShowsUserLocation:YES]; locationManager.delegate=self; locationManager = [

CLLocationManager in iOS9 giving incorrect locations (iOS8 is OK)

不羁岁月 提交于 2019-11-29 16:30:46
问题 We experience some weird issues on the locations from CCLocationManager starting from iOS9. iOS 7-8 has no issues. The weird locations cause errors in the app. The app is used while driving a car and we have about 50 test users in TestFlight and some of them are reporting these issues. The app reacts on location updates, each location update, each 25m and each 50m there is something to do. For test I've stored all these locations in an array. Our test users have a button which will send the

Significant Location Changes - What guarantees do we have?

一曲冷凌霜 提交于 2019-11-29 15:39:52
问题 I'm currently writing a Mobile iOS app that is using the iOS Significant Location Change service to manage lots and lots of geofences, enabling and disabling geofences as we receive this message from the CoreLocation Framework. On the Apple Developer Website it says: The significant-change location service delivers updates only when there has been a significant change in the device’s location, such as 500 meters or more. What really throws me off is "500 meters or more", what exactly is the

iOS 8 MKMapView User Location Request Failure

隐身守侯 提交于 2019-11-29 12:21:26
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> @property (strong, nonatomic) IBOutlet MKMapView *mapView; @property (strong, nonatomic)

Corelocation incorrect distances

强颜欢笑 提交于 2019-11-29 11:10:00
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 alloc]init]; locationManager.delegate = self; locationManager.distanceFilter =

Geolocation with local notification like reminder

可紊 提交于 2019-11-29 10:28:42
问题 i want implement geolocation notification like the app reminders. this is what i have already done: in App delegate: self.locationManager = [[[CLLocationManager alloc] init] autorelease]; /* don't leak memeory! */ [self.locationManager setDelegate:self]; [self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { } -(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region

iBeacon enter and exit region constantly every 1 minute

99封情书 提交于 2019-11-29 10:24:48
问题 I managed to get local notification when iBeacon (using Kontakt Beacon) enter a region in Background mode . at the same time I monitor 3 beacon regions with specific & unique Identifier (each has same UUID but unique Major and Minor combination). In Lock Screen Mode, my app can notify when these beacons present, but I don't know why even the beacons and my app all stay still almost next to each other, the delegate DidExitRegion is still called, please look at my Log. 2014-01-18 11:56:49.828