I've tried looking at other solutions such as: requestWhenInUseAuthorization() not Work in iOS 8 With NSLocationWhenInUseUsageDescription Key in Info.plist
But I can't get authorization prompt to get location.
That person's issue in that other question was that he had is manager inside his viewDidLoad
, I do not, but still an authorization prompt is not showing up. I've updated my plist:
and have my manager outside of my viewDidLoad
:
import UIKit
import AVFoundation
import MapKit
class SecondViewController: UIViewController, CLLocationManagerDelegate {
let locationManager: CLLocationManager = CLLocationManager()
var player = AVPlayer()
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.requestWhenInUseAuthorization()
self.locationManager.startUpdatingLocation()
println("Got to end of locationmanager")
//playentryaudio() // User plugged in mic -- start playing entry audio.
}
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
println("Got to locationmngsr")
var userlocation = locations[0] as! CLLocation
var latitude: CLLocationDegrees = userlocation.coordinate.latitude
var longitude: CLLocationDegrees = userlocation.coordinate.longitude
println(latitude)
println(longitude)
} //snip rest of code
Since It's not getting auth, It's never hitting the locationManager function.