core-location

Restart location updates from the background

岁酱吖の 提交于 2020-01-07 04:28:08
问题 I'm working on an app that monitors the user's location. After I call startUpdatingLocation() I can put the app in the background. It continues to update the location. That works well. My question is: can I restart the continuous location updates from a didExitRegion call in the background ? Now if I simply call startUpdatingLocation() again, the app gets killed after 10 seconds. func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) { locationManager

CLLocation current location not working

杀马特。学长 韩版系。学妹 提交于 2020-01-07 02:26:08
问题 I have this code in my class ViewController : CLLocationManager *locationManager; - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. locationManager = [[CLLocationManager alloc] init]; [locationManager requestWhenInUseAuthorization]; } - (IBAction)getCurrentLocation:(id)sender { locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; } #pragma mark -

Sometime Google Distance Matrix ZERO_RESULTS returned

僤鯓⒐⒋嵵緔 提交于 2020-01-06 15:43:59
问题 It is my first question about that is working if I set default lat and long and now I try to get location current location and use that. Also I following this one Get User's Current Location / Coordinates but failed to reach result. I am not sure what is going on here it is not working try to do it several way func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { //print(locations) //get the actual location from the device and first one each move let

Requesting in use authorization shows no prompt

社会主义新天地 提交于 2020-01-06 09:09:34
问题 I have NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription defined in my Info.plist. In my code I do if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { [_locationManager requestWhenInUseAuthorization]; } [_locationManager startUpdatingLocation]; And I don't get prompted on iOS8. I did a clean reinstall in my simulator. On iOS7 without the 3 if block I get prompted. Right after startUpdatingLocation I check [CLLocationManager

Requesting in use authorization shows no prompt

荒凉一梦 提交于 2020-01-06 09:08:47
问题 I have NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription defined in my Info.plist. In my code I do if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { [_locationManager requestWhenInUseAuthorization]; } [_locationManager startUpdatingLocation]; And I don't get prompted on iOS8. I did a clean reinstall in my simulator. On iOS7 without the 3 if block I get prompted. Right after startUpdatingLocation I check [CLLocationManager

iOS, CoreLocation - Get users location when the app loads

南楼画角 提交于 2020-01-06 01:50:27
问题 I am trying to get my app to get the longitude and latitude of the users current position as soon as they load up the app. From here I can tell if they are a certain distance from a point, and call different functions based on this. I can get it to work fine from viewDidLoad, but I don't want it to keep performing this every time said view is loaded. How would I (if possible) call this from the app delegates didFinishLaunchingWithOptions method? 回答1: I think you're looking for

can't set zoom level on MKMapView

南楼画角 提交于 2020-01-05 08:04:19
问题 i am adding MKCircleView to the user annotation like so : - (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation { if (!_MapCentered) { **_circle = [MKCircle circleWithCenterCoordinate:userLocation.coordinate radius:3000]; [_map_view addOverlay:_circle];** _MapCentered = YES; } } it will fire once and once the user location has traced, it works well but as you can see the diameter of the circle view is 3000 meters. so now i want the zoom level to fit the

How to received ibeacons different regions ranging event in single didRangeBeacons:inRegion callback.

跟風遠走 提交于 2020-01-05 04:23:27
问题 I'm trying to range iOS ibeacons with multiple regions and it works well. But my problem is, if I range multiple regions region1 and region2 , I received two ranging event calls, didRangeBeacons:inRegion separately. (So, if I show the beacons list in tableview, it is flashing.) I want to received all regions with different identifier in ranges into single didRangeBeacons:inRegion callback (not one callback for one region. one callback for all regions in range). I saw it can be done with

How to calculate the center coordinates of CLLocationDistance

人走茶凉 提交于 2020-01-02 18:38:32
问题 I want calculate the center point between my location and some annotation. So far I have done this: CLLocation *myLoc = self.locMgr.location; MKPointAnnotation *middleAnnotation = [locationV.annotations objectAtIndex:locationV.annotations.count/2]; CLLocation *someStuiodLoc = [[CLLocation alloc] initWithLatitude:middleAnnotation.coordinate.latitude longitude:middleAnnotation.coordinate.longitude]; CLLocationDistance dist = [myLoc distanceFromLocation:someStuiodLoc]; How can I calculate the

iOS 5 Region Monitoring: Can new regions be created based on users current coordinates from coreLocation?

风格不统一 提交于 2020-01-02 18:24:12
问题 My question is regarding the creation of regions for regionMonitoring in iOS 5. Can new regions be created based on user of the app's current location? Or do all regions need to be predefined by the developer in the applications binary? I know you can have certain regions register based on the users current location, because the os puts a limit on the number of regions that the phone/app can be monitoring at one time, and you should only register the regions within close proximity to the