0
On all devices is OK, the request for permission to use the location appears (independent iOS 7 or iOS 8). Only iPhone 5 does not appear.
Code for requesting permission:
var versionString = UIDevice.currentDevice().systemVersion.stringByReplacingOccurrencesOfString(".", withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil) as NSString
if versionString.floatValue >= 800 {
if CLLocationManager.authorizationStatus() != CLAuthorizationStatus.Authorized && CLLocationManager.authorizationStatus() != CLAuthorizationStatus.AuthorizedWhenInUse {
if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.Denied {
NSLog("Not Accepted")
} else {
locationManager.requestAlwaysAuthorization()
}
}
} else {
if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.Denied {
NSLog("Not Accepted")
} else {
locationManager.startUpdatingLocation()
locationManager.stopUpdatingLocation()
}
}
I declared the Nslocationalwaysusagedescription key "We need your location"
iPhone 5 with iOS 8 or 7? Your access to the location is denied? Also see if your app is already listed on
Ajustes > Privacidade > [Nome do seu app]
– André Ribeiro
It is not listed, and does not show the dialog for requesting permission.
– Gian
But is iOS 8? Your access is denied?
– André Ribeiro
is iOS 8. On iOS 8 and 7 it makes the permission request, only on iPhone 5. On iPad, and on 6 it makes the question.
– Gian
You have already added the key
NSLocationWhenInUseUsageDescription
in your Info.plist?– André Ribeiro
Yes, I added: Nslocationalwaysusagedescription as Boolean type with true value
– Gian
NSLocationAlwaysUsageDescription
must be a valueString
. This description will appear to the user at the time the permission is requested.– André Ribeiro
Right, just this key? No more?
– Gian
Take a look at my answer and see if it helps you.
– André Ribeiro