我在Lion上使用XCode 4.1。我在iOS模拟器中运行核心位置代码时收到以下错误:
Starting Location Updates
server did not accept client registration 68
不确定如何解决?
位置代码:
//
// 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
答案 0 :(得分:1)
位置服务仅适用于iOS 5模拟器。您应该能够在模拟器或Xcode中更改设备。您可以将模拟器内的位置更改为自定义位置或Apple内置位置之一。
*注意:Xcode 4.3和iOS 5 Simulator仅适用于付费开发者(2011年10月5日)
答案 1 :(得分:1)
答案 2 :(得分:0)
您可能正在使用带有此xcode的Lion不支持的4.3模拟器。