core-location

Extending CLPlacemark results in EXC BAD ACCESS

心不动则不痛 提交于 2020-01-30 06:48:27
问题 Though there is a similar question found here it does not provide an answer, at least not for the general problem. My problem is: Since CoreLocation geocoding is rate limited and the (web-)service I am developing an app for provides its own fallback geocoding service, I want to use this custom geocoding service in case I reach Apple's rate limit. Furthermore, I feel it makes total sense to avoid a custom data type for results returned by this custom REST API and therefore would like to use

Extending CLPlacemark results in EXC BAD ACCESS

南楼画角 提交于 2020-01-30 06:48:08
问题 Though there is a similar question found here it does not provide an answer, at least not for the general problem. My problem is: Since CoreLocation geocoding is rate limited and the (web-)service I am developing an app for provides its own fallback geocoding service, I want to use this custom geocoding service in case I reach Apple's rate limit. Furthermore, I feel it makes total sense to avoid a custom data type for results returned by this custom REST API and therefore would like to use

CLLocationManager Delegate methods are not getting called

不羁的心 提交于 2020-01-30 05:06:01
问题 I am using CLLocationManager class. I have a simple class method for capturing the location +(void)captureLocation{ mLocationManager = [[CLLocationManager alloc]init]; mLocationManager.delegate = (id<CLLocationManagerDelegate>)self; mLocationManager.desiredAccuracy = kCLLocationAccuracyBest; [mLocationManager startUpdatingLocation]; } and i have the delegate methods of CLLocationManager also - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { } - (void

allowsBackgroundLocationUpdates in CLLocationManager in iOS9

对着背影说爱祢 提交于 2020-01-26 08:46:07
问题 I'm using CoreLocation framework in my app in Xcode7(pre-released),and I noticed that there is a newly added property called allowsBackgroundLocationUpdates in CLLocationManager class. What's the relationship between this property and the location updates in the Background Modes of the Capabilities tab. What's the default value of it and does it affect apps running in iOS9? 回答1: This new property is explained in the WWDC session "What's New in Core Location". The default value is NO if you

Check whether a CLLocation is based on GPS or cellular

左心房为你撑大大i 提交于 2020-01-24 22:22:10
问题 With a 3G GPS device (i.e. iPad 3G) is there a way to know if a reported CLLocation is based on a GPS signal, and not the inaccurate cellular data? 回答1: The CLLocation class has a method called -horizontalAccuracy:. This will give you some idea of the radius of accuracy of that measurement. This is probably better than asking just "is it GPS" because GPS readings can also be pretty inaccurate, depending on receiving conditions and satellite visibility. 来源: https://stackoverflow.com/questions

Getting user location when app is in background. IOS

情到浓时终转凉″ 提交于 2020-01-23 18:59:10
问题 I'm developing an app that works in the background to get the user's location and send it to server using http requests. My first intention was to get the user's location every n minutes, but after alot of research and trial, i gave up since ios kills my background tasks after 3 minutes. Then i tried working on MonitoringSignificantLocationChanges, but its inaccurate location updates due to cell tower usage ruins the purpose of my app. A solution to any of the following is greatly appreciated

Is there a way to trigger the .always coreLocation permission proactively in iOS13?

倾然丶 夕夏残阳落幕 提交于 2020-01-22 09:58:12
问题 Under iOS13, when you request the .always permission for coreLocation (to enable background location e.g. for geofences or iBeacons), the app is only granted a "provisional always" permission, which does not allow it to use coreLocation in the background. At a later stage, in principle the OS should popup a permission request to switch to the .always permission. I have yet to experience it, and it seems (looking at Apple developer forums) that nobody have found a way to consistently trigger

Location manager didUpdateLocations not being called

こ雲淡風輕ζ 提交于 2020-01-22 00:41:46
问题 For some reason didUpdateLocations is not being called, even when I set the delegate to the view controller. In info.plist I set the key Privacy - Location When In Use Usage Description to a description. So I'm not sure what I could be doing wrong? import MapKit import CoreLocation class OptionsViewController: UIViewController, UITableViewDelegate, CLLocationManagerDelegate { override func viewDidLoad() { //Ask user for location locationManager = CLLocationManager() locationManager

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

Why does Swift not update the variables outside the closure?

一曲冷凌霜 提交于 2020-01-15 12:26:26
问题 Here's the code I'm using -- Problem is that the value of latitude and longitude in the returned CLLocationCoordinate2D object are both -1, their initialized values. What am I missing? func getLocationInfoForAddress(shop: store) -> CLLocationCoordinate2D { var address = getAddressInOneLine(shop) var latitude: CLLocationDegrees = -1 var longitude: CLLocationDegrees = -1 var geocoder = CLGeocoder() geocoder.geocodeAddressString(address, {(placemarks: [AnyObject]!, error: NSError!) -> Void in if