Sheehan Alam
Sheehan Alam

Reputation: 60889

Core Location not working in iOS Simulator in Lion

I am using XCode 4.1 on Lion. I am getting the following error when running Core Location code in the iOS Simulator:

Starting Location Updates
server did not accept client registration 68

Not sure how to resolve?

Location Code:

//
//  LocationGetter.m
//  CoreLocationExample
//
//  Created by Matt on 7/9/09.
//  Copyright 2009 iCodeBlog. All rights reserved.
//

#import "LocationGetter.h"
#import <CoreLocation/CoreLocation.h>

@implementation LocationGetter

@synthesize locationManager, delegate;

BOOL didUpdate = NO;

- (void)startUpdates
{
    NSLog(@"Starting Location Updates");

    if (locationManager == nil)
        locationManager = [[CLLocationManager alloc] init];

    locationManager.delegate = self;

    // You have some options here, though higher accuracy takes longer to resolve.
    locationManager.desiredAccuracy = kCLLocationAccuracyKilometer;  
    [locationManager startUpdatingLocation];    
}

- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your location could not be determined." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
    [alert show];
    [alert release];      
}

// Delegate method from the CLLocationManagerDelegate protocol.
- (void)locationManager:(CLLocationManager *)manage didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    if (didUpdate)
        return;

    didUpdate = YES;

    // Disable future updates to save power.
    [locationManager stopUpdatingLocation];

    // let our delegate know we're done
    [delegate newPhysicalLocation:newLocation];
}

- (void)dealloc
{
    [locationManager release];

    [super dealloc];
}

@end

Upvotes: 1

Views: 2180

Answers (3)

Aleksander Azizi
Aleksander Azizi

Reputation: 9877

You should take a look at: How to find your current location with CoreLocation.

Aslo, you have the option to choose location when your using the iOS Simulator under Debug.

iOS Simulator Debug Menu

Upvotes: 1

Bill Burgess
Bill Burgess

Reputation: 14154

The location services only work in the iOS 5 simulator. You should be able to change devices in the simulator or from Xcode. You can change your location from inside the simulator to a custom location or to one of the locations Apple has built-in.

*NOTE: Xcode 4.3 and iOS 5 Simulator are only available to paid developers as of today (10/5/2011)

Upvotes: 1

TommyG
TommyG

Reputation: 4155

You are probably using the 4.3 simulator which is not supported on Lion with this xcode.

Upvotes: 0

Related Questions