Reputation:
@class CLLocationManager;
@interface CLLocationController : NSObject
{
CLLocationManager *locationManager;
}
@property (nonatomic, retain) CLLocationManager *locationManager;
@end
When i write above code is shows me following errors
error: CLLocationManager.h: No such file or directory warning: receiver 'CLLocationManager' is a forward class and corresponding @interface may not error: accessing unknown 'delegate' component of a property
Upvotes: 8
Views: 12840
Reputation: 243156
Also, don't forget you have to actually add the CoreLocation framework to your app. To do this, double click on your target, go to the first tab, and click the + button in the lower left. This will bring up a list of available frameworks. Find CoreLocation.framework, and click "OK".
Upvotes: 6
Reputation: 96333
Why are you declaring your own classes with the CL prefix?
Also, the error has nothing to do with the code you showed; it refers to the #import
line in your implementation file. You're probably doing something like this:
#import "CLLocationManager.h"
instead of the correct way:
#import <CoreLocation/CoreLocation.h>
Don't import individual headers from a framework directly—import its top-level header and let that give you what you need. If compilation is getting to take too long, move the #import
to your prefix header and make sure you have “Precompile Prefix Header” turned on.
Upvotes: 18