core-location

Core Location not working in iOS 8

僤鯓⒐⒋嵵緔 提交于 2019-11-28 07:03:28
I'm trying to use significant change location monitoring in iOS 8, but the didUpdateLocations method is never called. Here is the code for setting up the location manager: - (void)viewDidLoad { [super viewDidLoad]; CLLocationManager *locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; [locationManager requestWhenInUseAuthorization]; [locationManager startMonitoringSignificantLocationChanges]; } Despite calling requestWhenInUseAuthorization , nothing pops up to ask the user to authorize it. I have set NSLocationWhenInUseUsageDescription, and it still does not

Persisting CoreLocation

折月煮酒 提交于 2019-11-28 06:51:00
问题 I have a need to store the current location to 'disk' on the iphone if the application I'm writing is terminated. Then, when the app starts again, I want to restore this information. However, the CLLocation coordinate property is read only. What can I do to save this information between program invocations (and reapply it to a CLLocation object)? 回答1: You could use NSDefaults to store it. Something like #define kLocationLat @"LOCATION_LAT" #define kLocationLng @"LOCATION_LNG" // Store the

Corelocation and assisted gps iPhone

一曲冷凌霜 提交于 2019-11-28 06:16:30
问题 I have a quick question, does the core location in iOS 4.3.2 automatically use assisted gps or is this an option you need to choose. I am working with the GPS and I recon that the settle time before finding a good accuracy(below 10 meters) is rather long - a few minuts. Regards Bjarke 回答1: It's all automatic. The best you can do is check the altitude, which is undefined when a GPS fix is not available yet. edit: see http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference

Distance to a location while user is in motion

谁说我不能喝 提交于 2019-11-28 05:17:44
问题 I'm in the process of writing an application that shows the user's distance from a fixed point as the user walks around (i.e. the label showing the distance from the user to the point is updated every time the user moves). I use a CLLocationManager with the code shown below: - (void)viewDidLoad { locationManager=[[CLLocationManager alloc]init]; locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager

Corelocation incorrect distances

折月煮酒 提交于 2019-11-28 04:33:45
问题 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 =[

Search for all iBeacons and not just with specific UUID

血红的双手。 提交于 2019-11-28 03:36:20
Is it possible to search for all iBeacons which are nearby? I know it's possible to search iBeacons by UUID. But i want to find all iBeacons nearby. An iBeacon is a region, and has as defining property the UUID. Therefore, you can only search for the ones matching a UUID. After you find one or more with a specific UUID, you can figure out which is closest using the delegate callbacks, where the beacons are stored in an array ordered by distance. There is great sample code on this and also a pretty detailed WWDC video session: "What's new in Core Location" iBeacons are higher-level constructs

CLLocation returning negative speed

ぐ巨炮叔叔 提交于 2019-11-28 03:03:57
问题 I'm starting a new app which uses the coreLocation and the mapkit frameworks. My problem is trying to get the current speed always returns me a negative value, i have take my iPhone with me to places with a good 3g signal and it doesn't matter, location.speed value is always -1. here is the code which matters: #define kRequiredAccuracy 1500.0 //meters #define kMaxAge 60.0 //seconds in the init method: self.locationManager=[[CLLocationManager alloc] init]; self.locationManager.delegate=self;

What determines the presence of the iPhone Location Services icon in the status bar?

大兔子大兔子 提交于 2019-11-28 00:45:09
Here's my situation. I'm developing an iPhone application that uses Core Location to determine the device's location. There is an icon: the Location Services Icon, that appears in the device's status bar. I know enough to say that the purpose of the icon is to tell the user that Location Services are currently being used by something. To the perceptive user, this means decreased battery life. For that reason, I want to be sure that the icon is displayed only when Location Services are actually being employed by my app. Enter confusion. We, as developers, do not get access to the status bar via

iOS app doesn't ask for location permission

与世无争的帅哥 提交于 2019-11-28 00:31:16
问题 My Swift-iOS app is meant to show the user's location on a map. However, the XCode debug console tells me I need to ask permission to show the user's location. I think, I do that but the dialog never comes up. Here is the error message, and below the ViewController where I call CLLocationManager::requestWhenInUseAuthorization() Error: 2014-06-30 21:25:13.927 RowingTracker2[17642:1608253] Trying to start MapKit location updates without prompting for location authorization. Must call -

significant location change does not trigger on device

拜拜、爱过 提交于 2019-11-27 22:23:36
问题 I am using significant location change monitoring. When I run the code in the simulator and check Freeway option I get periodic location updates. I grab these updates and save them in NSUserDefaults and than update tableview every 10s, so I can see if I got any updates. If I run the app on a real device, I get zero updates. I kept the phone in my pocket and travelled over 80km, been in 2 cities. Zero updates. Not sure if I messed something up. I am attaching the code. The code is copy paste,