cllocationmanager

Find closest longitude and latitude in array from user location

安稳与你 提交于 2020-01-02 09:59:57
问题 I have an array full of longitudes and latitudes. I have two double variables with my users location. I'd like to test the distance between my user's locations against my array to see which location is the closest. How do I do this? This will get the distance between 2 location but stuggeling to understand how I'd test it against an array of locations. CLLocation *startLocation = [[CLLocation alloc] initWithLatitude:userlatitude longitude:userlongitude]; CLLocation *endLocation = [[CLLocation

Use of delegates in NSOperation

痴心易碎 提交于 2020-01-01 03:25:09
问题 I am trying to make use of CLLocationManager in an NSOperation . As part of this I require the ability to startUpdatingLocation then wait until a CLLocation is received before completing the operation. At present I have done the following, however the delegate method never seems to be called. Please can someone advise what the issue is? - (void)main { @autoreleasepool { if (self.isCancelled) return; // Record the fact we have not found the location yet shouldKeepLooking = YES; // Setup the

Region monitoring current location doesn't notify on exit

你说的曾经没有我的故事 提交于 2019-12-31 13:13:09
问题 I'm trying to test region monitoring, for that I'm getting current location like this: - (void)startLocationTracking { CLLocationManager *locationManager = [[CLLocationManager alloc] init]; // Start location manager if ([CLLocationManager locationServicesEnabled] && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized) { locationManager = [LocationTracker sharedLocationManager]; locationManager.delegate = self; [locationManager startMonitoringSignificantLocationChanges]

locationServicesEnabled always return YES

若如初见. 提交于 2019-12-31 10:45:26
问题 I tested my device (iPod Touch 2G iOS 4.1) if location services are enabled permitted = [locationManager locationServicesEnabled]; and I always get a YES whether location services are enabled or not. I'm talking about the general button for location services and not the app specific button. On iPad with iOS 3.2.2 everything is working fine. 回答1: When you implement the delegate for location manager, you should be implementing didFailWithError. In there you will get the appropriate error if the

Does the internal GPS antenas stop working immediately after calling CLLocationManager stopUpdatingLocation

╄→尐↘猪︶ㄣ 提交于 2019-12-31 07:25:12
问题 Here is my scenario. In my app there is no need of continuously monitoring user location, but I need the location to be as accurate as possible. So I just call CLLocationManager startUpdatingLocation with kCLLocationAccuracyBestForNavigation set as desiredAccuracy, and after I get the location with my desired accuracy (by comparing newLocation.horizontalAccuracy with predefined value) I want to stop the location update and revoke update again after several seconds. But when I call

iOS LocationManager is not updating location (Titanium Appcelerator module)

有些话、适合烂在心里 提交于 2019-12-31 05:45:12
问题 I've made Appcelerator Titanium Module for fetching device's rotaion and location. Source can be found on GitHub. The problem is that it fetches only one cached location but device motion data is OK and it is refreshing. I don't use delegate, I pull that data in my Titanium Javascript Code. If I set "City Run" in Simulator -> Debug -> Location nothing happens. The same cached location is returning. Pulling of location is OK because I tried with native app wich does this: textView.text =

Application doesn't launch with location key after a significant location change

六月ゝ 毕业季﹏ 提交于 2019-12-30 05:30:07
问题 My application uses the core location also after the application terminates with the method startMonitoringSignificantLocationChanges in CLLocationManager class. My application launches with a location key in iOS 5 and 6 in the method: - (BOOL) application:application didFinishLaunchingWithOptions:launchOptions; in AppDelegate class and everything works well. But in iOS-7 betas the application doesn't launch with a location key after a significant location change. Has anybody encountered this

Core Location region monitoring

旧城冷巷雨未停 提交于 2019-12-29 14:58:34
问题 Does anyone know any knowledge of using this: - (void) startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy I am trying to implement it into my project but: - (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region is never being called? Does anyone have any example code or know why this is happening? My code is as follows. I created a method like this in my own LocationManager class: - (void)

Core Location region monitoring

无人久伴 提交于 2019-12-29 14:57:56
问题 Does anyone know any knowledge of using this: - (void) startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy I am trying to implement it into my project but: - (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region is never being called? Does anyone have any example code or know why this is happening? My code is as follows. I created a method like this in my own LocationManager class: - (void)

Reverse geocoding in Swift 4

时光总嘲笑我的痴心妄想 提交于 2019-12-29 04:42:12
问题 I'm attempting to write a simple method that's fed CLLocationDegrees and returns a CLPlacemark . Looking at Apple's documentation, it seems like a simple task. Below is what I've dumped into a playground: import CoreLocation // this is necessary for async code in a playground import PlaygroundSupport // this is necessary for async code in a playground PlaygroundPage.current.needsIndefiniteExecution = true func geocode(latitude: CLLocationDegrees, longitude: CLLocationDegrees) -> CLPlacemark?