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
621
votes
26 answers

Location Services not working in iOS 8

My app that worked fine on iOS 7 doesn't work with the iOS 8 SDK. CLLocationManager doesn't return a location, and I don't see my app under Settings -> Location Services either. I did a Google search on the issue, but nothing came up. What could be…
ozg
  • 17,532
  • 5
  • 19
  • 21
234
votes
16 answers

Get User's Current Location / Coordinates

How can I store the user's current location and also show the location on a map? I am able to show pre-defined coordinates on a map, I just don't know how to receive information from the device. Also I know I have to add some items into a Plist. How…
Awais Hussain
  • 2,400
  • 2
  • 12
  • 11
180
votes
9 answers

How can I get current location from user in iOS

How can I get the current location from user in iOS?
mamrezo
  • 2,273
  • 5
  • 19
  • 23
110
votes
4 answers

Behaviour for significant change location API when terminated/suspended?

This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges: If you start this service and your application is subsequently terminated, the system automatically …
86
votes
19 answers

didFailWithError: Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"

I want to get the current location, but instead I get an error. This is a snippet of my view controller. - (void)viewDidLoad { self.locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:self]; [locationManager…
Luca
  • 20,399
  • 18
  • 49
  • 70
77
votes
10 answers

Xcode / iOS simulator: Trigger significant location change manually

Is there a way to manually tell the device to dispatch a significant location change notification that will wake up any applications registered for this notification? This is for testing only, and I realize this private API call would get rejected…
Nick
  • 1,194
  • 1
  • 10
  • 18
77
votes
1 answer

Why requestWhenInUseAuthorization doesn't prompt the user for access to the location?

In my viewDidLoad method I have locationManager = [[CLLocationManager alloc]init]; // initializing locationManager locationManager.delegate = self; // we set the delegate of locationManager to self. locationManager.desiredAccuracy =…
spen123
  • 3,464
  • 11
  • 39
  • 52
72
votes
12 answers

iOS: App is not asking user's permission while installing the app. getting kCLAuthorizationStatusNotDetermined every time - Objective-c & Swift

I am trying to fetch user location in my iOS app. I have included corelocation framework in my project first. Then on a button click I am invoking the core location api as below. When I am trying to install this in a device, the core location never…
Rashmi Ranjan mallick
  • 6,390
  • 8
  • 42
  • 59
66
votes
6 answers

didUpdateLocations instead of didUpdateToLocation

With the release of iOS6 Apple wants us to use didUpdateLocations instead of didUpdateToLocation. Can anyone explain how to properly use didUpdateLocations?
YogevSitton
  • 10,068
  • 11
  • 62
  • 95
65
votes
6 answers

allowsBackgroundLocationUpdates in CLLocationManager in iOS9

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…
tounaobun
  • 14,570
  • 9
  • 53
  • 75
57
votes
9 answers

IOS 9 Error Domain=kCLErrorDomain Code=0 "(null)"

Code below should get current location. But above error is generated. Function didUpdateLocations never gets called. Running this on a device (iPhone 5s)iOS 9.1. Info.plist has Required device capabilities and Privacy - Location usage description…
Tusshu
  • 1,664
  • 3
  • 16
  • 32
56
votes
8 answers

Checking location service permission on iOS

How can I check if location service is enabled for my app? I have 2 storyboards and I want to check location service. If location service enabled for my app, I want to launch map storyboard with location. Otherwise, I want to launch another…
Melih Mucuk
  • 6,988
  • 6
  • 37
  • 56
51
votes
11 answers

Show Current Location and Update Location in MKMapView in Swift

I am learning how to use the new Swift language (only Swift, no Objective-C). To do it, I want to do a simple view with a map (MKMapView). I want to find and update the location of the user (like in the Apple Map app). I tried this, but nothing…
PMIW
  • 757
  • 2
  • 7
  • 15
51
votes
8 answers

iOS 8 Map Kit Obj-C Cannot Get Users Location

I am working with Map Kit in iOS 8 using Obj-C NOT SWIFT. I cannot get the device location it is set a 0.00, 0.00 and I am getting the error: Trying to start MapKit location updates without prompting for location authorization. Must call…
MBarton
  • 2,087
  • 2
  • 14
  • 17
45
votes
9 answers

How to get current longitude and latitude using CLLocationManager-Swift

I want to get the current longitude and latitude of a location using Swift and display them via labels. I tried to do this but nothing displays on the labels. import UIKit import CoreLocation class ViewController: UIViewController,…
Beginner
  • 465
  • 1
  • 4
  • 5
1
2 3
99 100