Cannot find location error (kCLErrorDomain error 0)


#1

In chapter 4 (ed.3) I completed the code up to page 87. When running the iphone simulator and selecting a location I log this error:

2012-12-28 10:44:11.293 Whereami[4691:c07] Could not find location: Error Domain=kCLErrorDomain Code=0 “The operation couldn’t be completed. (kCLErrorDomain error 0.)”

Running the iphone hardware I don’t get any message logged.

I’ve checked for code type errors and could find none. Any ideas?


#2

I figured it out - a typo!

Correct:
didUpdateToLocation:(CLLocation *)newLocation

Error:
didUpdateTolocation:(CLLocation *)newLocation

By the way, despite the warning to check for typos and looking at this code for 30 minutes and missing this I still missed this. Very frustrating. Any one else struggle with this basic stuff?


#3

i am getting the same error and i dont have that typo can you help me?

[code]//
// WhereamiViewController.m
// WhereAmI
//
// Created by Alex Jenkins on 8/5/13.
// Copyright © 2013 Alexander Joseph Jenkins. All rights reserved.
//

#import “WhereamiViewController.h”

@interface WhereamiViewController ()

@end

@implementation WhereamiViewController

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {
    //Create location Mangaer Object
    locationManager = [[CLLocationManager alloc] init];
    
    /*And we want it to be as acurate as possible
     regardless of how much time /power it takes
     */
    [locationManager  setDesiredAccuracy:kCLLocationAccuracyBest];
    
    //There Will Be A Warning On This Line Of Code, IGNORE IT FOR NOW
    [locationManager setDelegate:self];
    
    //Tell our manger to start looking for its location immediatly
    [locationManager startUpdatingLocation];
}
return self;

}

  • (void)locationManager:(CLLocationManager *)manager
    didUpdateLocations:(NSArray *)locations
    {
    NSLog(@"%@", locations);
    }

  • (void)locationManager:(CLLocationManager *)manager
    didFailWithError:(NSError *)error
    {
    NSLog(@“Could Not Find Location: %@”, error);
    }
    @end[/code]