Reputation: 1480
I am using this code for current location in ios 8, but this give the error on 3rd line error is "no known class method for selector' requestAlwaysAuthorization".
if ([CLLocationManager respondsToSelector:
@selector(requestWhenInUseAuthorization)]) {
[CLLocationManager requestWhenInUseAuthorization];
}
Upvotes: 0
Views: 69
Reputation: 1991
In iOS 8 SDK, requestAlwaysAuthorization (for background location) or requestWhenInUseAuthorization (location only when foreground) call on CLLocationManager is needed before starting location updates.
Add two keys in the plist
<key>NSLocationAlwaysUsageDescription</key>
<string>Your message goes here</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your message goes here</string>
(Leave the values empty to use the default messages)
Upvotes: 1