cllocationmanager

Tracking multiple (20+) locations with iOS geofencing

对着背影说爱祢 提交于 2019-11-26 17:58:24
问题 An iOS application uses the geofencing for notifying the user about predefined nearby locations. The application is allowed to miss some location (the user is not getting a notification about a nearby location), but it is desirable to keep the missing rate low. One way to implement this would be to start monitoring for significant change locations with startMonitoringSignificantLocationChanges and each time the "location change" event is fired, look for locations within, let say, 500m radius

Xcode / iOS simulator: Trigger significant location change manually

我的未来我决定 提交于 2019-11-26 17:57:47
问题 Is there a way to manually tell the device to dispatch a significant location change notification that will wake up any applications registered for this notification? This is for testing only, and I realize this private API call would get rejected upon submission to the app store. 回答1: So two answers: A) Hop on a train :-) B) Use the simulator. In iOS 5.x simulator, there is a debug menu that has a location submenu. Choose freeway drive. This will start the simulator on an imaginary journey

iOS CLLocationManager in a separate class

本秂侑毒 提交于 2019-11-26 15:38:51
问题 I have multiple view controllers that need to get the user's location, so I wanted to create a separate class that the ViewControllers can call to get the user's latest location. locationManager:didUpdateToLocation:fromLocation returns void. How do I pass the latitude and longitude data back to my ViewControllers as soon as the user's latitude and longitude is calculated? I could try writing getters and setters in my locationManaging class, but if I do that, how do I know when to call the

Show Current Location and Update Location in MKMapView in Swift

ε祈祈猫儿з 提交于 2019-11-26 15:34:36
问题 I am learning how to use the new Swift language (only Swift, no Objective-C). To do it, I want to do a simple view with a map ( MKMapView ). I want to find and update the location of the user (like in the Apple Map app). I tried this, but nothing happened: import MapKit import CoreLocation class MapView : UIViewController, CLLocationManagerDelegate { @IBOutlet weak var map: MKMapView! var locationManager: CLLocationManager! override func viewDidLoad() { super.viewDidLoad() if

didFailWithError: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”

梦想的初衷 提交于 2019-11-26 15:21:16
I want to get the current location, but instead I get an error. This is a snippet of my view controller. - (void)viewDidLoad { self.locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; [locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations { // I would get the latest location here // but this method never gets called } - (void)locationManager:(CLLocationManager *)manager didFailWithError:

CLLocationManager delegate methods are not getting called(google maps is integrated)

和自甴很熟 提交于 2019-11-26 14:59:00
问题 The delegate Methods of CLLocationManager didChangeAuthorizationStatus and didUpdateToLocation are not getting called. Location Always Usage Description key is already added in info.plist and I am getting notification also when i launch app for the first time. I am able to see the google map, but i am not able to see current location, When i change location, its not getting updated. Basicaaly delegate methods are not getting called. //code import UIKit import GoogleMaps class ViewController:

Xcode 6 GM - CLLocationManager

China☆狼群 提交于 2019-11-26 14:39:14
问题 I have a project made using Xcode 5. I have a ViewController where i take the phone location using a CLLocationManager. I have implemented both: -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error which worked great. Now i opened the project with Xcode 6 GM, and neither of these 2 methods where called (not on simulator, or device). Any ideas? Thanks 回答1: Please check

allowsBackgroundLocationUpdates in CLLocationManager in iOS9

本秂侑毒 提交于 2019-11-26 14:23:38
I'm using CoreLocation framework in my app in Xcode7(pre-released),and I noticed that there is a newly added property called allowsBackgroundLocationUpdates in CLLocationManager class. What's the relationship between this property and the location updates in the Background Modes of the Capabilities tab. What's the default value of it and does it affect apps running in iOS9? Felix This new property is explained in the WWDC session "What's New in Core Location" . The default value is NO if you link against iOS 9. If your app uses location in the background (without showing the blue status bar)

Start Location Manager in iOS 7 from background task

让人想犯罪 __ 提交于 2019-11-26 14:09:17
It seems that in iOS 7 an app can not start Location Manager (by calling startUpdatingLocation) from the background task anymore. In iOS 6 I used approach described here: https://stackoverflow.com/a/6465280 to run background location update every n minutes. The idea was to run background task with a timer and start Location Manager when the timer triggers it. After that turn off Location Manager and start another background task. After updating to iOS 7 this approach does not work anymore. After starting Location Manager an app does not receive any locationManager:didUpdateLocations. Any ideas

StartUpdateLocations in Background, didUpdatingToLocation only called 10-20 times

大城市里の小女人 提交于 2019-11-26 13:04:13
问题 Testing Device: iPhone 5 (iOS 7) I have an app that uses RegionMonitoring and updateLocation . If a region is entered, didEnterRegion is called as expected. Then I call startUpdatingLocation . But the method didUpdateToLocation is only called 10-20 times while it should update the location until the timer fires. The relevant code: CLLocationManager *_locationManager; NSTimer *_timer; -(void)initLocationManager { _locationManager = [[CLLocationManager alloc] init]; _locationManager.delegate =