ios - MapView doesn't ask for location permission -


I'm trying to create a map view in Swift. It has already been working but something is changing, after which I do not remember, I am getting the following error now:

  Mapicat location without prompting for location authority Trying to start the update. Calling is required - [CLLocationManager requests when inauthority] or - [CLLocationManager requestsNow always authorization] Firstly.  

NSLocationAlwaysUsageDescription is in my .plist file.

Here is the code:

  Import UIKit import macquet class AwesomeMap: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {var map: MKMapView? Var Manager: CLLocationManager? Function setup () {! Manager = CLLocationManager () manager .delegate = self-map = self // Show being .delegate set another controller manager .requestAlwaysAuthorization () manager .startUpdatingLocation ()!} LocationManager (manager function: CLLocationManager!, DidChangeAuthorizationStatus position: CLAuthorizationStatus ) {println ( "permisison redesigned") if (state == CLAuthorizationStatus.AuthorizedWhenInUse || state == CLAuthorizationStatus.Authorized) {map .showsUserLocation = true}!} locationManager (manager function: CLLocationManager!, didUpdateLocations places: [AnyObject] ) {(Places as arrays) {var loc = (Place as CLLocation) ) Println (loc.coordinate.latitude) to area = MKCoordinateRegion (for a location in the center: loc.coordinate, period: MKCoordinateSpanMake (0.05, 0.05)) Show! KsetRegion (region animated: true)}} function locationManager (Manager: CLLocationManager!, didFailWithError error: NSError) {println ( "failed")}}  

Before applying some tips old code:

  import Aiaiket import Mapakit class AwesomeMap: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {var manager = CLLocationManager () var map: MKMapView? Func setup (mapView: MKMapView) {// passing through IBOutlet from another controller / I think the change made by me was around the following six rows ... Map Map Map Map View! .delegate = self manager.delegate = self manager.requestAlwaysAuthorization! () Show .showsUserLocation = true manager.startUpdatingLocation ()} locationManager function (Manager: CLLocationManager!, DidUpdateLocations places: [AnyObject]) in Println {(places such as array) {var loc = (ranked as CLLocation) for (loc.coordinate.latitude) to area = MKCoordinateRegion (in the middle: Lockcoordinate, period: MKCoordinateSpanMake (0.05, 0.05)!) Show KsetRegion (region animated: true)}} function locationManager (Manager: CLLocationManager! , DidFailWithError Error: NSError!) {Println ("Failed") / / Nothing here}  

}

you only Calling is allowed

  Map! .showsUserL Ocation = true  

Your Location Manager has been granted permission to use user space.

(No faster version of this is found, but you probably get the point)

  - (zero) Location Manager: Changed by Manager (CLLocationManager *) ManagerOrganization Status: (CLAuthorizationStatus) status {if (condition == kCLAuthorizationStatusAuthorizedWhenInUse || condition == kCLAuthorizationStatusAuthorizedAlways} {self.mapView.showsUserLocation = YES; }}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -