core-location

How to notify user when he enters a CLLocation?

雨燕双飞 提交于 2019-12-11 04:13:32
问题 SITUATION: I followed the following tutorial: https://www.raywenderlich.com/95014/geofencing-ios-swift PROBLEM: The following functions never get triggered: AppDelegate.swift func locationManager(manager: CLLocationManager, didEnterRegion region: CLRegion) { if region is CLCircularRegion { handleRegionEvent(region) } } func locationManager(manager: CLLocationManager, didExitRegion region: CLRegion) { if region is CLCircularRegion { handleRegionEvent(region) } } func handleRegionEvent(region:

How do I convert CoreLocation coordinates to a String?

我与影子孤独终老i 提交于 2019-12-11 03:06:57
问题 func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) { var user_lat = manager.location.coordinate.latitude var user_long = manager.location.coordinate.longitude self.locationManager.stopUpdatingLocation() } I've tried String(manager.location.coordinate.latitude) but that doesn't seem to work. 回答1: Try with format let user_lat = String(format: "%f", manager.location.coordinate.latitude) let user_long = String(format: "%f", manager.location.coordinate

Not able to get the user's location in iOS 8 using CLLocation Manager?

≡放荡痞女 提交于 2019-12-11 02:55:11
问题 I tried to get the user's latitude and longitude but I got result 0.000000 - I have tried following code. I have assign the location manager variable. Location Manager allocated and set the delegate is self. Checked the iOS 8 version validation requesting. Using location start update location function. Code: locationmanager=[[CLLocationManager alloc]init]; locationmanager.delegate=self; // check before requesting, otherwise it might crash in older version if ([locationmanager

location manager giving null coordinates

放肆的年华 提交于 2019-12-11 02:35:34
问题 The following code results in null coordinates. The weird thing is the UIAlert prompting the app to use current location appears briefly before the user can select yes. My code which i have used : CLLocationManager *locationManager; locationManager.desiredAccuracy = kCLLocationAccuracyBest; [locationManager startUpdatingLocation]; locationManager = [[CLLocationManager alloc] init]; locationManager.distanceFilter = kCLDistanceFilterNone; locationManager.desiredAccuracy =

how to automatically zoom mapView to show overlay

时光毁灭记忆、已成空白 提交于 2019-12-11 00:25:44
问题 I am able to draw the polygon on mapView however I need to locate the polygon and zoom it manually. Is there a way to do this process automatically like adjust the polygon in centre? I have browsed the internet and read few related articles, most of them are based on polylines and points. Any kind of help will be appreciated, as I am finding for the solution for a while. Thanks in advance. Using the following methods to draw the polygon on mapView : - func drawFence(coordinates: UnsafePointer

Working with location updates when app is terminated

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 21:44:48
问题 I am working on a project in which i am trying to get location updates in all states, even when app is terminated. I have used all possible solutions but still it's not working in case of termination.For now I want to clear a doubt - I am using startUpdatingLocation() for foreground and background. As we know that startMonitoringSignificantLocationChanges() is the only method that relaunch app in case of any location update. Can we call "startMonitoringSignificantLocationChanges()" in

Hows does Significant Location Change work?

老子叫甜甜 提交于 2019-12-10 20:49:55
问题 Can anyone confirm how Significant Location Change works? movement is calculated when the iPhones cell receiver swaps from one cell tower to another as the user moves around? movement is calculated by triangulating between "visible" cell towers to best calculate the users position? movement is calculated by triangulation between "visible" cell towers based on the settings associated with desiredAccuracy? 回答1: Number 1 is the right answer. This is the reason, those updates come not very often.

Current Location returning 0

家住魔仙堡 提交于 2019-12-10 20:29:10
问题 My Xcode app that I am developing needs to get the latitude and longitude of the users iOS device. Although currently all I get is 0 for both values. It does not ask for permission to have the location, and I am on a real device not a simulator. NSLocationAlwaysUsageDescription is in my info.plist I have also imported CoreLocation and in my .h file @interface LocationViewController : UIViewController <CLLocationManagerDelegate> in my .m file @interface LocationViewController ()

Removing the background location alerts in iOS?

廉价感情. 提交于 2019-12-10 19:24:16
问题 I'm writing a navigation app that tracks the user location. In order to continue showing notification about the route (when phone is locked, answering the phone, etc.) - i also need to continue tracking the location while the app is in the background: (Capabilities>Background Modes>Location updates, locationManager.allowsBackgroundLocationUpdates = true) I have been struggling with this question for a very long time and read a lot about it, but couldn't find the answer i'm looking for. i have

CLLocation Prompt shows and disappears in one moment

纵然是瞬间 提交于 2019-12-10 17:56:04
问题 In my app I try to get longitude and latitude from GPS. To do that I have to ask user about permission to access to his location. Before I do that I add to Info.plist this two rulees: Privacy - Location When In Use Usage Description and Privacy - Location Always Usage Description , then in AppDelegate I ask about permission doing it (SWIFT 3.0): if CLLocationManager.locationServicesEnabled() == true { let localisationManager = CLLocationManager() localisationManager