requestAlwaysAuthorization not showing permission alert

前端 未结 17 1064
我寻月下人不归
我寻月下人不归 2020-12-29 20:19

I\'m trying to use some fancy iBeacons without success, kCLAuthorizationStatusNotDetermined all time. According to other questions it\'s a requirement to add those keys to

相关标签:
17条回答
  • 2020-12-29 21:14

    recently, IOS 13, * save result request permission after user reinstall app

    0 讨论(0)
  • 2020-12-29 21:16

    Swift 3.X Latest code easily usage

    import CoreLocation
    
     public var locationManager = CLLocationManager()
    
        override func viewDidLoad() {
            super.viewDidLoad()
    
    
            locationManager.delegate = self
            locationManager.requestAlwaysAuthorization()
            locationManager.startUpdatingLocation()
    
    }
    
    
    
        func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
    
            let altitudeG = locations.last?.altitude
            let longitudeG = locations.last?.coordinate.longitude
            let latitudeG = locations.last?.coordinate.latitude
    
    print("\(altitudeG) \(longitudeG) \(latitudeG)")
    
        }
    
    0 讨论(0)
  • 2020-12-29 21:17

    Make sure you add the keys to the correct Info.plist file. Don't forget there's one for your App and one for AppTest.

    0 讨论(0)
  • 2020-12-29 21:19

    Had exactly the same problem. It turned out that in my case the NSLocationAlwaysUsageDescription was required in my InfoPlist.strings localization files as well. Having NSLocationAlwaysUsageDescription in Info.plist wasn't enough...

    0 讨论(0)
  • 2020-12-29 21:21

    Try to Start Updating Location (have helped for me)

    [self.locationManager startUpdatingLocation];
    
    0 讨论(0)
提交回复
热议问题