0
我嘗試更新用戶當前位置時,遇到了錯誤,我的相關代碼是這樣的:試圖更新位置
#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)
你在模擬器上工作嗎? –
是的,我目前在模擬器上測試:) – Malloc
cllocationmanager不能在模擬器上工作這就是爲什麼你得到這個錯誤 –