1

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
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556

3 Answers3

1

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

Community
  • 1
  • 1
Aleksander Azizi
  • 9,829
  • 9
  • 59
  • 87
1

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)

Bill Burgess
  • 14,054
  • 6
  • 49
  • 86
  • I am a paid developer, except on my new machine I installed XCode from the App Store. How should I proceed? Should I wipe that out, and just use the XCode from developer.xcode.com? – Sheehan Alam Oct 05 '11 at 20:05
  • If you want to use the location services, you will have to take the version from the developer portal. Just no other way around it. The update for Lion should go live in a couple weeks, so you could always wait, but if you need to test now, you'll need the latest GM (Gold Master) build of Xcode from Apple. – Bill Burgess Oct 05 '11 at 20:25
0

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

TommyG
  • 4,145
  • 10
  • 42
  • 66