0

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];
   }
Ravi Ojha
  • 1,480
  • 17
  • 27

1 Answers1

1

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)

WhiteLine
  • 1,919
  • 2
  • 25
  • 53