Ios 尝试更新位置时出错

Ios 尝试更新位置时出错,ios,cllocationmanager,Ios,Cllocationmanager,我尝试更新用户当前位置,我的相关代码如下: #pragma mark- #pragma mark CLLocationManagerDelegate -(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { float latitude=newLocation.coord

我尝试更新用户当前位置,我的相关代码如下:

#pragma mark-
#pragma mark CLLocationManagerDelegate
-(void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
    float latitude=newLocation.coordinate.latitude;
    float longitude=newLocation.coordinate.longitude;
    TopStationAppDelegate *topStation=(TopStationAppDelegate *)[[UIApplication sharedApplication]delegate];
    topStation.latitudeUtilisateur=latitude;
    topStation.longitudeUtilisateur=longitude;
    NSLog(@"%f",latitude);
    NSLog(@"%f",longitude);
    NSLog(@"position updated");
    //[locationManager stopUpdatingLocation];

}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error 
{
    NSLog(@"didFailWithError: %@", error);
}
didFailWithError
方法返回我这个堆栈:

ERROR,Time,332840118.515,Function,"void CLClientHandleDaemonDataRegistration(__CLClient*, mach_port_t, const CLDaemonCommToClientRegistration*, const __CFDictionary*)",server did not accept client registration 2
2011-07-20 09:35:18.525 TopStation[764:207] didFailWithError: Error Domain=kCLErrorDomain Code=1 "The operation couldn’t be completed. (kCLErrorDomain error 1.)"

你能帮我吗?thanx Prevance:)

正如前面的评论所述,您正在使用的模拟器版本不适用于基于位置的东西。你最好的选择(如果你是一名付费开发者)是下载新的Xcode 4.2,它允许你操作位置数据并实际使用模拟器

若你们不是付费的开发者,你们将不得不在设备上进行测试


如果您是付费开发人员,请查看本文中的一些链接。您可以查看WWDC视频,了解如何使用模拟器进行位置测试。

您是否正在使用模拟器?是的,我目前正在使用模拟器进行测试:)cllocationmanager不在模拟器上工作这就是您出现此错误的原因