PDA

View Full Version : CLLocationManager NSInvalidArgumentException




RAMilewski
Sep 3, 2008, 02:06 PM
I'm getting the following error:

'NSInvalidArgumentException', reason: '*** -[CLLocationManager <ignored selector>]: unrecognized selector sent to instance 0x148eb0'

in this code:

-(void)begin
{
// turn on the network activity spinner in the menu bar and set up the location manager
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
locationManager = [[CLLocationManager alloc] init];

// set the delegate to us, set the accuracy and start updating
locationManager.delegate = self;
locationManager.distanceFilter = 500;
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;
[locationManager startUpdatingLocation];
}


A bit of noodling with GDB indicates that the problem is the line:

locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;

(i.e. if I set a breakpoint at that line the program runs up to that point. pressing the GDB Continue button throws the error and the program counter continues to point at that line.)

So the question is: Is this really the problem? ...and if not where else should I be looking?