cllocationmanager

Confirm user's selection of “Don't Allow” location services

偶尔善良 提交于 2019-12-11 17:13:16
问题 I am using location services in my app. Initially the app asks the user to allow finding the current location. If the user says "Don't Allow", can I show one more alert to confirm that choice? Then, if the user says "Allow" in that second dialogue, can the app get the current location? 回答1: No you can't, it is managed by the the system. You can/should check if the user allowing you app to get the current location. Because you can change this in the settings app Check can be done like this: if

Will Realm still be able to save the data while user has locked iPhone?

情到浓时终转凉″ 提交于 2019-12-11 16:57:30
问题 I am trying to save some data to Ream database while users have locked their iPhone. Thie data may be the location coordinate which produced by background location updates. If realm can't do it. Could Core Data do it? This is how I do it in code: - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray<CLLocation *> *)locations { NSLog(@"didUpdateLocations: %@", locations); if (locations.count > 0) { CLLocation *location = locations.firstObject; if (location

startMonitoringForRegion not working

流过昼夜 提交于 2019-12-11 15:48:35
问题 I want Location based Reminder when user reaches to certain region For that I have writen followin code CLLocationManager *manager=[[CLLocationManager alloc] init]; manager.desiredAccuracy=kCLLocationAccuracyBest; manager.delegate=self; CLLocationCoordinate2D loc; loc.latitude=LReminder.lat; loc.longitude=LReminder.lon; CLRegion *region=[[CLRegion alloc] initCircularRegionWithCenter:loc radius:LReminder.accuracy dentifier:LReminder.title]; CLLocationAccuracy acc=1.0; [manager

Calling Location in Multiple Parts of App

最后都变了- 提交于 2019-12-11 15:42:54
问题 I want to use the following code to find a user's location in multiple parts of my app. To avoid complexity, I only want to have one place where I get the user's location. I would assume that I need to put it in my appDelegate and then call it somehow from the other views when I need to use it. Does anyone know what I would need to use to get the location as an NSString on the views/tabs other than my appDelegate? Thank you! - (NSString *)deviceLocation { NSString *theLocation = [NSString

iBeacon Bluetooth didEnterRegion and didExitRegion methods are never fired

风流意气都作罢 提交于 2019-12-11 13:54:26
问题 It's very strange that didEnterRegion and didExitRegion are never fired after startMonitoringForRegion is called. In addition, didDetermineState could be triggered as expectation. During the current stage, I only evaluate the iBeacon tech based on Apple's sample code demo, Airlocated. Therefore, I only implement two methods, including didEnterRegion and didExitRegion in the file APLAppDelegate.m as bellow: - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region

Objective C, iOS 7 - CLLocationManager: didUpdateLocations is being called only once

你说的曾经没有我的故事 提交于 2019-12-11 12:34:14
问题 EDIT: Ok, I just have noticed that the problem is exclusive of iOS 7. I'm still being unable to solve it, however, so I suppouse I'll try with the sugestions bellow. Thanks to all! ¡Hi! I'm programming a navigator app, and I need to update the user position whenever is possible. I have two View Controllers that use CLLocation manager. In both of them I've added this line: #import <CoreLocation/CoreLocation.h> And then added the to the interface declaration, and I'm setting this as a property

iOS 8 CLLocationManagerDelegate methods are never called

ぃ、小莉子 提交于 2019-12-11 12:03:21
问题 //View did Load Method- LocationManager is allocated and have included the CLLocationManagerDelegate in .h File -ViewDidLoad{ self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; self.locationManager.desiredAccuracy=kCLLocationAccuracyBest; self.locationManager.distanceFilter=kCLDistanceFilterNone; [self.locationManager requestWhenInUseAuthorization]; [self.locationManager startMonitoringSignificantLocationChanges]; [self.locationManager

iOS: get Accurate Reverse Geocoding using CLLocationManager?

拟墨画扇 提交于 2019-12-11 09:34:28
问题 Background: I want to allow users to get their location within seconds when they want it. However, the location is mostly inaccurate. I want to ask the user to if they would like to try again for a more accurate address. Question: How to code such that it guarantees that the next guess, is always better than the last guess. What I have tried: CLLocationManager *locationManager; - (CLLocationManager *)locationManager { if (locationManager != nil) { return locationManager; } locationManager = [

Is it possible to determine the Geolocation method used?

荒凉一梦 提交于 2019-12-11 07:51:33
问题 I am using CLLocationManager to get location updates in my app. Is there a way to determine what the GeoLocation method was? E.g. GPS, Triangulation, IP (Network). 回答1: Not really. You can take a look at the horizontalAccuracy of a CLLocation object and hazard a guess based on its value, though: < 25 meters: probably GPS < 200 meters: probably Wi-Fi anything greater: probably cell-tower triangulation These values are just off the top of my head—to be most accurate you’ll probably want to do

How to properly set the Radius of CLRegion?

邮差的信 提交于 2019-12-11 06:58:52
问题 This is my code for creating a geofence: Geofence *geofence = [[Geofence alloc] init]; [geofence setRadius:100.0]; [geofence setIdentifier: @"Fence1"]; [geofence setLocation:currentlocation]; CLRegion *region1 = [[CLCircularRegion alloc] initWithCenter:[geofence.location coordinate] radius:geofence.radius identifier:geofence.identifier]; region1.notifyOnEntry=YES; region1.notifyOnExit=YES; [self.locationManager startMonitoringForRegion:region1]; I could say that, the above code works, meaning