cllocationmanager

iOS 8 Map Kit Obj-C Cannot Get Users Location

点点圈 提交于 2019-11-26 07:19:47
问题 I am working with Map Kit in iOS 8 using Obj-C NOT SWIFT. I cannot get the device location it is set a 0.00, 0.00 and I am getting the error: Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first. I have implemented: ( I have tried only one at a time and no luck ) if(IS_OS_8_OR_LATER) { [self.locationManager requestWhenInUseAuthorization]; [self

CLLocation Manager in Swift to get Location of User

最后都变了- 提交于 2019-11-26 06:36:16
问题 I am trying to convert an old app in ObjC to Swift as a practice exercise and have ran in to some issues. The way I had it in the old app, it was establishing the CLLocation Manager and then I would use: manager = [[CLLocationManager alloc]init]; manager.delegate = self; manager.desiredAccuracy = kCLLocationAccuracyBest; [manager startUpdatingLocation] which would call automatically: -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation

Behaviour for significant change location API when terminated/suspended?

此生再无相见时 提交于 2019-11-26 06:10:58
问题 This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges: If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate contains the key UIApplicationLaunchOptionsLocationKey to

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

佐手、 提交于 2019-11-26 04:22:33
问题 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

Start Location Manager in iOS 7 from background task

混江龙づ霸主 提交于 2019-11-26 03:49:05
问题 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.

Get User&#39;s Current Location / Coordinates

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 01:48:34
问题 How can I store the user\'s current location and also show the location on a map? I am able to show pre-defined coordinates on a map, I just don\'t know how to receive information from the device. Also I know I have to add some items into a Plist. How can I do that? 回答1: To get a user's current location you need to declare: let locationManager = CLLocationManager() In viewDidLoad() you have to instantiate the CLLocationManager class, like so: // Ask for Authorisation from the User. self

How can I get current location from user in iOS

∥☆過路亽.° 提交于 2019-11-26 00:27:05
问题 How can I get the current location from user in iOS? 回答1: The answer of RedBlueThing worked quite well for me. Here is some sample code of how I did it. Header #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface yourController : UIViewController <CLLocationManagerDelegate> { CLLocationManager *locationManager; } @end MainFile In the init method locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter =

Get User&#39;s Current Location / Coordinates

五迷三道 提交于 2019-11-25 23:34:30
How can I store the user's current location and also show the location on a map? I am able to show pre-defined coordinates on a map, I just don't know how to receive information from the device. Also I know I have to add some items into a Plist. How can I do that? Annu To get a user's current location you need to declare: let locationManager = CLLocationManager() In viewDidLoad() you have to instantiate the CLLocationManager class, like so: // Ask for Authorisation from the User. self.locationManager.requestAlwaysAuthorization() // For use in foreground self.locationManager

Location Services not working in iOS 8

巧了我就是萌 提交于 2019-11-25 21:46:30
问题 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