Similar to #4 but with a nuance.
In iOS 11, it is advised to first ask the user for whenInUse location authorization, and then at a later time upgrade that to always authorization.
Using PromiseKit/CoreLocation 6.2.5, the request for always will fail to return if whileInUse has been granted and a location has been requested.
Here is a small chain that demonstrates the issue:
_ = firstly {
CLLocationManager.requestAuthorization(type: .whenInUse)
}.then { _ in
CLLocationManager.requestLocation()
}.then { _ in
CLLocationManager.requestAuthorization(type: .always)
}.done { _ in
print("tada")
}
In order to test this in a project, the usage description keys will need to be added to the Info.plist file:
<key>NSLocationWhenInUseUsageDescription</key>
<string>When In Use</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Always</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Always and When In Use</string>
Running that promise, the log tada is never printed. By removing the requestLocation promise from the chain, it all works as expected.
I also have a small demo project reproducing this, I can supply if that helps.
Similar to #4 but with a nuance.
In iOS 11, it is advised to first ask the user for
whenInUselocation authorization, and then at a later time upgrade that toalwaysauthorization.Using PromiseKit/CoreLocation 6.2.5, the request for
alwayswill fail to return ifwhileInUsehas been granted and a location has been requested.Here is a small chain that demonstrates the issue:
In order to test this in a project, the usage description keys will need to be added to the
Info.plistfile:Running that promise, the log
tadais never printed. By removing therequestLocationpromise from the chain, it all works as expected.I also have a small demo project reproducing this, I can supply if that helps.