cllocationmanager

iOS 8 - Can't get current location, Error Domain=kCLErrorDomain Code=0

别等时光非礼了梦想. 提交于 2019-12-05 14:42:28
I've problem with getting my current location. I still getting error: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)" I already did everything that I found here: Reset content and settings in iOS Simulator (map application in simulator shows correct location). In Xcode at Product>Scheme>Edit I unmarked Allow Location Simulation (when I mark it,It simulate e.g. London). I have added NSLocationWhenInUseUsageDescription to Info.plist file in my project (App asks for Location permissions and I can see them in Settings in iOS simulator). I have Wi

Is there any performance penalty for using multiple CLLocationManager instances

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 12:26:52
问题 I have at least two controllers in my app that currently use their own CLLocationManager instance. I'm curious however if using multiple instances actually imposes any additional burden on the phone - beyond the additional memory for the different instances. Will the iPhone ping the GPS hardware multiple times, or does it use some sort of dispatch such that the hardware is abstracted and just forwarded to all listeners? I was about to write my own abstraction layer to handle multiple

Disabling allowsBackgroundLocationUpdates (CLLocationManager) doesn't work after is was enabled

允我心安 提交于 2019-12-05 11:55:16
My Application works with continuous background location updates. Of course it has all the permissions and other stuff like allowsBackgroundLocationUpdates = true Initially I wanted to react to LowPowerMode changes while in background using NSProcessInfoPowerStateDidChange notification. And to disable allowsBackgroundLocationUpdates to stop updating locations without calling stopUpdatingLocation . However, I found out that after receiving the notification and setting allowsBackgroundLocationUpdates = false in background application is going on working. So I went farther and identified, that

How do you use CLRegion in iOS 7 since initCircularRegionWithCenter:radius:identifier: is deprecated?

戏子无情 提交于 2019-12-05 10:33:11
问题 Since the depreciation of initCircularRegionWithCenter:radius:identifier: , how would you define the region to be monitored using CLLocationManager ? 回答1: Since CLCircularRegion is a subclass of CLRegion , you can just cast the instance. CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:theCenter radius:theRadius identifier:theIdentifier]; // Then cast the instance for use with your CLLocationManager instance [manager startMonitoringForRegion:(CLRegion *)region]; 来源: https:/

Can I get the accuracy of GPS location in iOS?

左心房为你撑大大i 提交于 2019-12-05 10:17:07
I've seen Android developers get the accuracy of a GPS location. Is there a way that I can get the accuracy of my currenct GPS location in iOS? I am using the code from this answer to get my location: locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@

iphone app: Questions on interaction between CLLocationmanager and MKMapView (showing current user location)

我的未来我决定 提交于 2019-12-05 10:00:23
In my iPhone app, I have the following logic: Start CLLocationManger (the user can supply accuracy and distance filters parameters to locationmanager, since best accuracy is not required in my case, 100-300 meters will do fine, and I'd like to save battery on this). After GPS fix is obtained by LocationManager (and only if this fix is obtained), I create and display the map. Both CLLocationManager and MKmapView are part of the same ViewController. To show the current location, I set mapView.showsUserLocation:YES, to display the blue dot. The locationManager I started still keeps working,

CLLocationManager kCLErrorDomain Codes?

喜夏-厌秋 提交于 2019-12-05 09:03:05
Using iBeacon and CoreLocation I'm receiving the following error: Error Domain=kCLErrorDomain Code=16 "The operation couldn’t be completed. (kCLErrorDomain error 16.) Unless I'm missing it, there doesn't seem to be a clear reference on Apple for what each of the error code means. Can anyone interpret this error code? The error calls from: - (void)locationManager:(CLLocationManager *)manager rangingBeaconsDidFailForRegion: (CLBeaconRegion *)region withError:(NSError *)error{ NSLog(@"%@", error); } - (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region

CLLocationManager not getting City name

只愿长相守 提交于 2019-12-05 07:54:08
I am trying to get the current city and country using CLLocationManager with below code - #pragma mark - Core Location Delegate Methods - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { CLGeocoder *reverseGeocoder = [[CLGeocoder alloc] init]; [reverseGeocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error) { NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!"); if (error){ NSLog(@"Geocode failed with error: %@", error); return; } NSLog(

Understanding background tracking of user's location in iOS

梦想的初衷 提交于 2019-12-05 04:50:09
问题 I need to keep getting user's location updates when app going to background and, as I found in Apple's documentation, this is one of the long-running background tasks that are allowed to be implemented. I also need to make some processing and network calls to send to server some info when location updates are notified. What I'm trying to do, in broad strokes, is something like this: - (void)applicationDidEnterBackground:(UIApplication *)application { bgTask = [application

singleton for location updating multiple views

北战南征 提交于 2019-12-05 04:39:31
问题 I want to update user location in ALL views, after the locateButton in the navbar is pressed in ANY view. I've started by creating a singleton. Location.h #import <Foundation/Foundation.h> #import <CoreLocation/CoreLocation.h> #import <MapKit/MapKit.h> @interface Location : NSObject <CLLocationManagerDelegate> @property (nonatomic, strong) CLLocationManager* locationManager; + (Location*)sharedSingleton; @end Location.m #import "Location.h" @implementation Location { CLLocationManager