core-location

CoreLocation kCLErrorDomain error 5

蓝咒 提交于 2019-12-03 00:14:07
I subclassed a CLRegion to support Polygons via overriding containsCoordinate: to use ray casting logic instead of the original distance crunching logic. The subclass is initialized via the normal method ( initCircularRegionWithCenter:radius:identifier: ), then CLLocationCoordinate2d s are added as NSValue s to a mutable array. These coordinates are used during the ray casting logic. As soon as I try to use the CLRegion subclass, I am confronted with a ton of errors in my application logic, as well as the following error: 2013-07-18 16:46:44.515 Geofencing[4816:907] (identifier 6C11CBAF-3EE4

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

巧了我就是萌 提交于 2019-12-03 00:11:09
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:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *

iOS revoke location services permission programmatically

…衆ロ難τιáo~ 提交于 2019-12-02 21:48:02
问题 Is there a function on CLLocationManager or UIApplication to revoke location permission that is similar to the function unregisterForRemoteNotifications to revoke the push notification permission? The stopUpdatingLocation function on CLLocation does not revoke the permission. 回答1: Once a user has granted (or denied) location permissions by responding to the original permission request dialog, the only way that the permissions can be changed is by the user themselves using the device settings

iOS CoreLocation (null) crash

谁都会走 提交于 2019-12-02 21:13:15
I've been getting this error in my app through Crashlytics. I can't find where and how this crash occurs. Here is the log from Crashlytics: Thread : Crashed: com.apple.main-thread 0 CoreLocation 0x0000000183f62304 (null) + 60044 1 CoreLocation 0x0000000183f230f0 (null) + 1436 2 CoreLocation 0x0000000183f230f0 (null) + 1436 3 CoreLocation 0x0000000183f2261c (null) + 1980 4 CoreFoundation 0x0000000183754c9c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 5 CoreFoundation 0x0000000183754940 __CFRunLoopDoTimer + 884 6 CoreFoundation 0x0000000183752054 __CFRunLoopRun + 1520 7

CLGeocoder reverseGeocodeLocation returns 'kCLErrorDomain error 9'

霸气de小男生 提交于 2019-12-02 20:57:58
I'm developing an iOS app with reverse geocoding features according to this article: geocoding tutorial But when I test like this on simulator, I get 'kCLErrorDomain error 9'. I've searched a lot and there are only error 0 or 1 not 9. Here is my code in viewDidLoad : self.locationManager = [[CLLocationManager alloc]init]; self.locationManager.delegate = self; self.locationManager.distanceFilter = 80.0; [self.locationManager startUpdatingLocation]; CLGeocoder *geocoder = [[[CLGeocoder alloc] init] autorelease]; [geocoder reverseGeocodeLocation:self.locationManager.location completionHandler:^

Make MKMapView only zoom in on the centerCoordinate?

匆匆过客 提交于 2019-12-02 20:12:06
问题 I have a MKPinAnnotationView that is always in the center of the map. When panning and zooming the pin gives me the center coordinates (lat/long) of the map. Currently when you zoom in, it just zooms into wherever your directing the map to zoom into. I'd really like to lock the zoom onto the pin. Any ideas on how I'd achieve this? 回答1: Assuming by MKPinAnnotation you mean MKPinAnnotationView, you can access the annotation's coordinate and use that to create a region and subsequently set the

how to get the current location in latitude and longitude in objective c

大兔子大兔子 提交于 2019-12-02 18:37:50
I am using the following code to get the current location,I have added the corelocation framework - (void)viewDidLoad { [super viewDidLoad]; locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m [locationManager startUpdatingLocation]; } - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { int degrees = newLocation.coordinate

Why MKCoordinateSpan changes?

瘦欲@ 提交于 2019-12-02 18:09:46
问题 When I debug code below, I see that span is changed by mapkit from what I have provided. span2 contains different numbers from what was provided. Why is this happening? - (void) viewDidLoad { [super viewDidLoad]; CLLocationCoordinate2D loc; loc.latitude = self.atm.lat; loc.longitude = self.atm.lon; MKCoordinateSpan span1 = MKCoordinateSpanMake(0.05f, 0.05f); self.mapView.region = MKCoordinateRegionMake(loc, span1); // at this point numbers are not 0.05 anymore MKCoordinateSpan span2 = self

Convert address to coordinates swift

匆匆过客 提交于 2019-12-02 16:50:48
How can I convert a String address to CLLocation coordinates with Swift? I have no code yet, I looked for a solution but I didn't find anyone yet. Thanks. This is pretty easy. let address = "1 Infinite Loop, Cupertino, CA 95014" let geoCoder = CLGeocoder() geoCoder.geocodeAddressString(address) { (placemarks, error) in guard let placemarks = placemarks, let location = placemarks.first?.location else { // handle no location found return } // Use your location } You will also need to add and import CoreLocation framework. You can use CLGeocoder, you can convert address(string) to coordinate and

How to prevent the rounding off when getting doubleValue from string?

为君一笑 提交于 2019-12-02 15:52:46
问题 I am getting latitude and longitude from server in JSON which is in string format then i am using this latitude and longitude by converting the values of latitude and longitude in double value by using default doubleValue function but by using this value is rounded off. So, How can i prevent the rounding off when getting doubleValue from string? Here is my code CLLocationCoordinate2D defaultLoc; defaultLoc.latitude = [[self.obj valueForKey:@"latitude"] doubleValue]; defaultLoc.longitude = [