core-location

Will the kCLLocationAccuracyBestForNavigation setting in Core Location Improve Location Services for Walking Around?

你。 提交于 2019-12-04 16:00:12
问题 I have an application that needs to keep very precise data about where a user is walking. Will having kCLLocationAccuracyBestForNavigation turned on as opposed to kCLLocationAccuracyBest gain me anything in this situation? Thanks. 回答1: kCLLocationAccuracyBestForNavigation is better for what you want to achieve as opposed to kCLLocationAccuracyBest. the only reason not to pick the BestForNavigation is the support of devices with iOS<4. As a side note, kCLLocationAccuracyBestForNavigation will

how to trap the location alert response iphone

大兔子大兔子 提交于 2019-12-04 13:03:40
I am using GPS in iphone and it show conformation message for use location service. and i want to trap what user select "Allow" or "No". can any one suggest how i do this? Thank You don't get a direct callback from this alert. However, if the user does not allow Core Location usage, you'll receive a -locationManager:didFailWithError: with a kCLErrorDenied error to your CLLocationManagerDelegate . Since iOS 4.2, you can also listen to -locationManager:didChangeAuthorizationStatus: or check the authorizationStatus of CLLocationManager . This gives you a detailed status. 来源: https://stackoverflow

Find nearest by lat/long with Core Data

99封情书 提交于 2019-12-04 12:49:25
问题 I have an iPhone app with a Core Data database containing a list of locations, each with lat/long coordinates. How can I search for say the nearest 10 to my current location? I'm new to Core Data so my question is really how to do the lookup, I know how to get my current location etc. I believe I need to setup an NSPredicate with a query term but not sure exactly how that should be written. Thanks, J 回答1: You may try this (reference) double M_PI = 3.141592653589793; #define d2r (M_PI / 180.0)

MKMapView: Zoom to default “country level”

限于喜欢 提交于 2019-12-04 12:05:46
when putting a MKMapView into a UIViewController and setting it to Satellite view, the map is zoomed and adjusted to show the whole country the user is current located in: For example the United States as shown below. When the user is now zooming the map or I'm zooming the map programmatically, it doesn't seem to be able to restore this default zoom level. Of course I could find out the coordinates of this default zoom in order to zoom back to that setting, but practically I would need to do that for every single country which isn't really worth it. Does someone know how to solve this problem?

Ranging Beacons in iOS 10

て烟熏妆下的殇ゞ 提交于 2019-12-04 12:04:06
问题 In my app, I use Beacon Region Monitoring in CoreLocation. The app sets 2 proximityUUID as region (they have different id), and start ranging like following. #pragma mark - CLLocationManagerDelegate (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { [self.locationManager requestStateForRegion:(CLBeaconRegion *)region]; } - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { [self.locationManager stopRangingBeaconsInRegion:

How to ask permission from user for second time to allow to access the current location?

自古美人都是妖i 提交于 2019-12-04 10:36:36
In my app, if the user not allowed to access their current location, I can recieve that message in the following method - (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)anError { switch([anError code]) { case kCLErrorLocationUnknown: break; case kCLErrorDenied: { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Access Denied" message:@"You didn't allow to access your current location" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; break; } } } How to ask the user permission for the second time? I searched and got the answer

Can I send user's current location to server, when app is in background?

丶灬走出姿态 提交于 2019-12-04 10:29:04
Can I send user's current location to server when app is in background. For example: In my app i want to store the user's current location in every 2min and then send his current location to server. Can I do this when the app is in background? Can I send location updates to the server in background mode and how? You can since iOS7. You basically need to ask for two background states: location and fetch. In your app you'll register for gps location changes, and store them every time your callback is called. Then you'll register for: application:performFetchWithCompletionHandler: This is usually

WatchKit CoreLocation issue

核能气质少年 提交于 2019-12-04 10:14:08
I am trying to read current location coordinates in WatchKitExtension ExtensionDelegate. This does though not return any value. The very same code used in WatchKitExtension InterfaceController does return the location. (tried this out of desperation as I could not find an error in the code) I would need to perform this code in ExtensionDelegate as I would like to pass the retrieved location on to a ClockKit Complication. Here the code in ExtensionDelegate: (after self.locationManager.requestLocation() the delegate functions didUpdateLocation / didFailWithError do not get called) import

Save photo with geolocation data to photo library Swift 3

狂风中的少年 提交于 2019-12-04 08:54:07
How can I save a photo to photo library with geolocation metadata? I have requested (and allowed) the app to access user location: private func allowAccessToUserLocation() { locationManager = CLLocationManager() locationManager.delegate = self locationManager.requestWhenInUseAuthorization() } Do I need to ask for specific premissions for the camera app? EDIT: I use UIImagePickerController to take photos from within the app. All photos taken from within the app are stored in the photo library WITHOUT the geolocation. Does it have anything to do with the way I save the image to photo library? Is

How to wait until location is completely found? (Core Location)

点点圈 提交于 2019-12-04 08:34:38
问题 I have a problem within my app. I'm trying to find the user's location to the best preciseness in order to determine their zip-code. Currently I have a button that, when pressed, starts a method named locateMe . -(IBAction)locateMe; { self.locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; Then I've implemented didUpdateToLocation: -(void)locationManager: