Questions tagged [cllocationmanager]

The CLLocationManager class defines the interface for configuring the delivery of location- and heading-related events to your application

The CLLocationManager class defines the interface for configuring the delivery of location- and heading-related events to your application. You use an instance of this class to establish the parameters that determine when location and heading events should be delivered and to start and stop the actual delivery of those events. You can also use a location manager object to retrieve the most recent location and heading data.

A location manager object provides support for the following location-related activities:

  • Tracking large or small changes in the user’s current location with a configurable degree of accuracy.
  • Reporting heading changes from the onboard compass. (iOS only)
  • Monitoring distinct regions of interest and generating location events when the user enters or leaves those regions.
  • Deferring the delivery of location updates while the app is in the background. (iOS 6 and later only)
2729 questions
22
votes
4 answers

iOS9 not tracking location while in background

My app tracks location while in background... the location background mode is enabled and i use [self.locationManager startUpdatingLocation]; This works great on iOS7-8 but it stopped working on iOS9 In simulator it works, but on real device i get…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
20
votes
4 answers

Checking for iOS Location Services

I have a view with a map and a button (like the Maps app once) that allows the user to center and zoom his current location on the map. If I can not use the locationServicesEnabled method (always returns YES), should I create a BOOL attribute to…
Daniel García Baena
  • 1,191
  • 4
  • 19
  • 33
20
votes
3 answers

CLLocationManager in iOS9 giving incorrect locations (iOS8 is OK)

We experience some weird issues on the locations from CCLocationManager starting from iOS9. iOS 7-8 has no issues. The weird locations cause errors in the app. The app is used while driving a car and we have about 50 test users in TestFlight and…
Sjoerd Perfors
  • 2,317
  • 22
  • 37
20
votes
5 answers

Swift 2 CLLocationManager Error updating

i updated Xcode 6 to Xcode 7 beta with Swift 2. I get this error and i can't find out how to fix it, please help me. Thanks. This is my code : func locationManager(manager: CLLocationManager, didUpdateLocations locations: [AnyObject]) { let…
markutus
  • 603
  • 2
  • 8
  • 12
20
votes
10 answers

How to check if MKCoordinateRegion contains CLLocationCoordinate2D without using MKMapView?

I need to check if user location belongs to the MKCoordinateRegion. I was surprised not to find simple function for this, something like: CGRectContainsCGPoint(rect, point). I found following piece of code: CLLocationCoordinate2D topLeftCoordinate =…
Lukasz
  • 19,816
  • 17
  • 83
  • 139
19
votes
8 answers

Rotate GMSMarker in direction at which user facing

I have requirement like on my current location one view will display. It will rotate if device was rotate or location will be change.I research lot but got all the code which have a fix location or angle at some location but i haven't fix location.…
18
votes
3 answers

How to prompt user to turn on Location Services...again

I want to have the same functionality as the Map app, where user is prompted every time they press the 'current location' button to turn on their Location Services if they are off: Turn off location services User presses 'getCurrentLocation'…
toofah
  • 4,455
  • 4
  • 31
  • 42
18
votes
1 answer

Is there any performance penalty for using multiple CLLocationManager instances

I have at least two controllers in my app that currently use their own CLLocationManager instance. I'm curious however if using multiple instances actually imposes any additional burden on the phone - beyond the additional memory for the different…
Paul Alexander
  • 31,970
  • 14
  • 96
  • 151
18
votes
1 answer

How do you use CLRegion in iOS 7 since initCircularRegionWithCenter:radius:identifier: is deprecated?

Since the depreciation of initCircularRegionWithCenter:radius:identifier:, how would you define the region to be monitored using CLLocationManager?
Luthelis
  • 264
  • 2
  • 9
17
votes
1 answer

How to handle "Don't Allow" for location manager?

I haven't think of this yet now . Till now whenever device was asking me use location update I was allowing it . But when now I am not allowing then it the location manager gives me kclErrorDenied and the location manager can not start again until…
harshalb
  • 6,012
  • 13
  • 56
  • 92
17
votes
1 answer

MKMapView and CLLocationManager

I want to use a MKMapView to display the user current location using the default breathing blue pin and I want to record the user movement at the same time. Is there any way that I could use the GPS manager (not sure if this is a CLLocationManager)…
Patrice
  • 183
  • 1
  • 6
17
votes
12 answers

Get location name from Latitude & Longitude in iOS

I want to find current location name from latitude and longitude, Here is my code snippet I tried but my log shows null value in all the places except in placemark, placemark.ISOcountryCode and placemark.country I want value of placemark.locality…
Krunal
  • 6,440
  • 21
  • 91
  • 155
17
votes
2 answers

UIBackgroundModes location and significant location changes with region monitoring

I have an app that uses a combination of startMonitoringForRegion: and startMonitoringSignificantLocationChanges to keep aware of where the user is when the app is in the background. Does this mean that I need to include the location value for the…
Adam Swinden
  • 1,917
  • 2
  • 18
  • 24
17
votes
5 answers

iOS CLLocationManager in a separate class

I have multiple view controllers that need to get the user's location, so I wanted to create a separate class that the ViewControllers can call to get the user's latest location. locationManager:didUpdateToLocation:fromLocation returns void. How do…
user1467188
  • 617
  • 1
  • 10
  • 28
17
votes
3 answers

How do startMonitoringSignificantLocationChanges and startUpdatingLocation effect one-another?

What happens if I call startUpdatingLocation while startMonitoringSignificantLocationChanges is running? Does significantLocationChange monitoring get stopped? If I then stopUpdatingLocation will significantLocationChange monitoring continue or…
Undistraction
  • 42,754
  • 56
  • 195
  • 331