cllocationmanager

locationManager didEnterRegion not called in XCode 9 Simulator

淺唱寂寞╮ 提交于 2020-01-17 08:23:30
问题 I have an app that does geofencing. When I run it in the Simulator (Xcode 8.3.3 and Xcode 9), everything seems to work with the exception that my CLLocationManager didEnterRegion is never called. It is called just fine when I run the app on my iPhone, either out in the real world (entering a region) or in Xcode via location simulation. Any idea why this would be? One difference I've discovered is that the simulator only supports monitoring location when in use, so I had to set things up so I

CLLocationManager Update frequency

拜拜、爱过 提交于 2020-01-16 04:57:39
问题 I have configured locationManager as follows. _locationManager = [[CLLocationManager alloc] init]; [_locationManager setDelegate:self]; [_locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; [_locationManager setDistanceFilter:kCLDistanceFilterNone]; When the application runs, I get some updates from the delegate methods. And when I do not change the location, and the mobile is stationary for about 2 hrs, I receive about 10-12 updates in the first 10 mins, and then stop

No visible @interface for 'CLLocationManager' declares the selector 'requestAlwaysAuthorization'

依然范特西╮ 提交于 2020-01-15 11:14:30
问题 We are making an app to be compatible with iOS 8, but at the same time, some of our developers do not have Xcode 6 yet, so they are getting this error when trying to call [self.locationManager requestAlwaysAuthorization]; Even if it is inside an if if(floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1) { [self.locationManager requestAlwaysAuthorization]; } How can we solve this to compile on Xcode 5? 回答1: The following is the proper way to deal with this. This assumes that

method not called from app delegate in ios

荒凉一梦 提交于 2020-01-14 05:48:27
问题 I want to call a method from elsewhere in the app to get the user's location that was obtained in the app delegate. When calling CLLocation *getCurLoc = [AppDelegate getCurrentLocation]; from another view controller, nothing is returned. The App Delegate is, @synthesize locationManager; CLLocation *location; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ locationManager = [[CLLocationManager alloc]init]; locationManager.delegate =

CLLocationManager not getting City name

半腔热情 提交于 2020-01-13 09:26:28
问题 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:

Monitoring regions but location icon disappears when app is killed

流过昼夜 提交于 2020-01-13 06:59:29
问题 I have a CLLocationManager contained in a singleton and I have added around a dozen regions to monitor. I am successfully notified of boundary crossings when the app is in the foreground/background. However, when I force quit the app, the location icon disappears and I am not getting any callbacks. 回答1: As far as I can see, this is intended functionality as of iOS7. Here is a reply I found to a similar question, in this case involving significant location change: https://devforums.apple.com

Turning user location annotation with heading

我只是一个虾纸丫 提交于 2020-01-12 08:40:12
问题 I'm trying to change the User Annotation in my app so that it shows the usual blue dot, but with a triangle coming off of it to show which direction the user is facing (I'd rather rotate the user annotation than the entire map, which is what MKUserTrackingModeFollowWithHeading does). I've got a rudimentary version working, but it has some weird behavior. First, some code: -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation { if ([annotation

Geofencing didEnterRegion,didExitRegion function not Calling in iphone 5S iOS8.1

不打扰是莪最后的温柔 提交于 2020-01-11 09:51:30
问题 I had debugged all day and delegate did get called at all. - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region Well here is my standard code calling for a monitor. use CoreLocation.framework. [locationManager startMonitoringForRegion:geofence]; And registered these in my plist. <key>NSLocationAlwaysUsageDescription</key> <string>Lugang</string> <key>NSLocationWhenInUseUsageDescription</key> <string>Lugang</string> background app refresh in enable, but I didn

CLLocationManager don't stop

好久不见. 提交于 2020-01-11 05:40:30
问题 Dear fellow developers, I am trying hard to find a solution for my problem regarfing CLLocationManager. I use a CLLocationManager instance in my Application. If the user selects the Home button on the device or terminates the application I want the location services to stop. Therefor I call [self.locationManager stopUpdatingLocation]; - But this somehow doesn't work. The application enters the background and the small location arrow in the upper right corner of the status bar don't disappear.

Reverse Geocode Location in Swift [closed]

喜夏-厌秋 提交于 2020-01-09 06:21:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . My input is a latitude and longitude. I need to use the reverseGeocodeLocation function of swift, to give me the output of the locality. The code I have tried to use is println(geopoint.longitude) println(geopoint.latitude) var manager : CLLocationManager! var longitude :CLLocationDegrees = geopoint.longitude