core-location

iOS HTTP request while in background

与世无争的帅哥 提交于 2019-11-27 04:25:43
It is possible to make HTTP async requests to PHP server while the app being in background? The app is a location based one, and should gather current location and send the coordinates to server every 5(or other value) minutes. Can I make the http posts to the server even the app is in background? I read lot of thoughts about this, but some of them told that can be done, others that can't be done. Thanks, Alex. It can be done but it is unreliable because you ask the OS for time to send something and it can accept or deny your request. This is what I have (stolen from somewhere on SO): [...] /

iOS7 Core Location not updating

安稳与你 提交于 2019-11-27 03:56:01
问题 I have a very simple app example that initialises and updates the users location.. On device it successfully throws another callback location every second or so however on device (iPhone running iOS7) is calls the method once and then mysteriously stops... //Setup Location Manager in ViewDidLoad locationManager = [[CLLocationManager alloc] init]; [locationManager setDistanceFilter:kCLDistanceFilterNone]; [locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; [locationManager

Centering MKMapView on spot N-pixels below pin

北城余情 提交于 2019-11-27 03:50:12
Want to center MKMapView on a point N-pixels below a given pin ( which may or may not be visible in the current MapRect ). I've been trying to solve this using various plays with -(CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view to no success. Anyone been down this road ( no pun intended )? The easiest technique is to just shift the map down, say 40% from where the coordinate would be, taking advantage of the span of the region of the MKMapView . If you don't need actual pixels, but just need it to move down so that the CLLocationCoordinate2D in question

kCLErrorDomain error 2 after geocoding repeatedly with CLGeocoder

ε祈祈猫儿з 提交于 2019-11-27 03:47:45
问题 I have a search bar in my application that the user can type an address into, and it will come up with the geocoded result. The result updates as the user types, according to the following code: - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { ... if (self.geocoder.geocoding) [self.geocoder cancelGeocode]; [self.geocoder geocodeAddressString:searchText completionHandler:^(NSArray *placemarks, NSError *error) { if (error != nil) { NSLog(@"ERROR during geocode:

why self.locationManager stopUpdatingLocation doesn't stop location update

半腔热情 提交于 2019-11-27 03:46:27
问题 Problem : It seems I can't stop Core Location from sending updates to my app / tracking. What am I doing : In my viewWillAppear I call self.locationManager and pass it to a method to show user's location on the map (an instance of MKMapView ). The getter is overridden to check for availability of the serive, to see whether its authorized. If so, it allocs/inits and startMonitoringSignificantLocationChanges and returns . In viewDidDisappear , I call [self.locationManager stopUpdatingLocation]

Finding distance between CLLocationCoordinate2D points

≡放荡痞女 提交于 2019-11-27 03:02:30
问题 I know from documentation we can find distance between two CLLocation points using the function, distanceFromLocation: . But my problem is I dont have CLLocation data type with me, I have the CLLocationCoordinate2D points. So how can I find distance between two CLLocationCoordinate2D points. I have seen the post post but not helpful for me. 回答1: You should create an object of CLLocation using, - (id)initWithLatitude:(CLLocationDegrees)latitude longitude:(CLLocationDegrees)longitude; Then, you

How can I prompt the user to turn on location services after user has denied their use

做~自己de王妃 提交于 2019-11-27 03:00:23
I have an application with an explicit user interaction that makes use of the user's current location. If the user denies access to location services, I would still like subsequent uses to prompt the user to go to settings and re-enable location services for my app. The behavior I want is that of the built-in Maps app: Reset location warnings in Settings > General > Reset > Reset Location Warnings. Start Maps app. Tap Current Location button in lower left corner. Maps prompts with ""Maps" Would Like to Use Your Current Location" | "Don't Allow" | "Allow". Choose "Don't Allow" option. Tap

iPhone CoreLocation: How to get the most accurate speed

*爱你&永不变心* 提交于 2019-11-27 02:55:22
问题 I'm experimenting with adding the GPS functionality to my iPhone app. It's a workout app that will be used while walking or running. So what I want to use GPS for is to show the speed that the person is moving in Mph and minute/mile. How should I configure the CLLocationManager so I get the best possible results? What should I set desiredAccuracy and distanceFilter? I've tried with: distanceFilter = 10 and desiredAccuracy = kCLLocationAccuracyNearestTenMeters and reading CLLocation.speed

What's the easiest way to get the current location of an iPhone?

与世无争的帅哥 提交于 2019-11-27 02:54:35
I already know how to use the CLLocationManager, so I could do it the hard way, with delegates and all that. But I'd like to have a convenience method that just gets the current location, once, and blocks until it gets the result. Brad The App Guy What I do is implement a singleton class to manage updates from core location. To access my current location, I do a CLLocation *myLocation = [[LocationManager sharedInstance] currentLocation]; If you wanted to block the main thread you could do something like this: while ([[LocationManager sharedInstance] locationKnown] == NO){ //blocking here //do

iOS 6 and Location Services not working

∥☆過路亽.° 提交于 2019-11-27 02:25:11
问题 I've updated my iOS SDK to version 6. After that I've compiled my app (works fine in iOS 4 & iOS 5 ) but now the location services doesn't work. My delegate isn't receiving any update and the upper location arrow is not appearing... I'm starting the service as the usual way: [locationManager startUpdatingLocation]; My project is non ARC. What is happening? This is driving me crazy... Thanks in advance. 回答1: Make sure you have a CFBundleDisplayName in your project's .plist file. Adding that