Alan
Alan

Reputation: 1134

CLLocationManager does not define requestAlwaysAuthorization or requestWhenInUseAuthorization

I am attempting to perform validation on the user's status regarding their location. I instantiated the CLLocationManager and whenever I attempt to call either requestAlwaysAuthorization or requestWhenInUse I do not get an autocomplete value, even if I finish typing I get a no visible interface for CLLocationManager defines either request method . I verified this in the CLLocationManager.h, and sure enough they are not there. Only requestStateForRegion selector. I am using google maps API and whenever I get the location through the google API it does prompt me so the functionality is working on the emulator just not sure why I cannot do it through the CLLocationManager directly.

Here is my view controller's .h

#import <UIKit/UIKit.h>

#import <GoogleMaps/GoogleMaps.h>

#import "EVTMapCanvas.h"

@import CoreLocation;

@interface EVTEventsViewController : UIViewController <CLLocationManagerDelegate>

@end

Upvotes: 0

Views: 426

Answers (2)

Rob
Rob

Reputation: 438212

These specialized location authorization methods are part of the iOS 8 SDK. If you are using an old version of Xcode that doesn't have the iOS 8 SDK, you won't see any of these methods in the headers and you won't see any auto completion, either. If you want these new methods, I would advise upgrading Xcode to the current version and gaining access to the latest SDK.

Note, as of February, all new apps must use the iOS 8 SDK and as of June, any new updates of existing apps must use the new SDK, as well. For more information, see 64-bit and iOS 8 Requirements for App Updates.

Upvotes: 0

Pham Hoan
Pham Hoan

Reputation: 2127

Your code looks good to me. I think it's xcode's problem, not yours.

Try to:

  • Clean project( cmd + shift + K)
  • Clean build folder (cmd + shift + alt + K)
  • Clean derived data (Windows -> Organizer or Windows -> Project for Xcode 6 b4)
  • Restart Xcode

It should be fixed now.

Upvotes: 1

Related Questions