0
현재 응용 프로그램에서 현재 위치를 찾기 위해 실행 중이지만 처음에는 오른쪽 지역에서 종속 지역을 반환하지만 didUpdateLocations는 didFailWithError로 이동하고 도메인 = kCLErrorDomain 코드 = 0 "(null)"을 반환하십시오. 나는도메인 = kCLErrorDomain 어떤 ios 장치에서 코드 "0 (null)"
- 리셋 콘텐츠 및 설정 등의 diffrent diffrent 해결 방법을 시도해보십시오이 엑스 코드에서
- , 제품 -> 계획 -> 편집 계획은 다음 "위치 시뮬레이터 허용"취소하고 아이폰 OS 시뮬레이터 및 컨텐츠 재설정 Xcode 에 설정하고 다시 시도하고 첫 번째 단계를 반복하고 iOS 시뮬레이터로 리셋합니다.
하지만 그 일의 아무도
는이 내 코드는 여기에 없습니다 : 업데이트 위치 처음 블록을
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
NSLog(@"didFailWithError%@",error);
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:@"Error" message:@"Failed to Get Your Location" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];}
을 오류 및이 오류가 간다
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations{
NSLog(@"didUpdateToLocation: %@", [locations lastObject]);
CLLocation *currentLocation = [locations lastObject];
if (currentLocation != nil)
{
self.lblLongitude.text = [NSString stringWithFormat:@"%.12f", currentLocation.coordinate.longitude];
self.lblLatitude.text = [NSString stringWithFormat:@"%.12f", currentLocation.coordinate.latitude];
}
NSLog(@"Resolving the Address");
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"Found placemarks: %@, error: %@", placemarks, error);
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
NSString *geoMapItem = placemark.description;
NSRange start = [geoMapItem rangeOfString:@"dependentLocality"];
NSRange end = [geoMapItem rangeOfString:@")" options:NSCaseInsensitiveSearch range:NSMakeRange(start.location, 1000)];
NSString *dataString = [geoMapItem substringWithRange:NSMakeRange(start.location, end.location - start.location + end.length)];
dataString = [dataString stringByReplacingOccurrencesOfString:@"\n" withString:@""];
dataString = [dataString stringByReplacingOccurrencesOfString:@" " withString:@""];
dataString = [dataString stringByReplacingOccurrencesOfString:@"\"" withString:@""];
start = [dataString rangeOfString:@"("];
end = [dataString rangeOfString:@")"];
NSLog(@"datastring===>%@",dataString);
lblAddress.text = [NSString stringWithFormat:@"%@ \n%@ %@\n%@\n%@",
dataString,
placemark.postalCode, placemark.locality,
placemark.administrativeArea,
placemark.country];
} else
{
NSLog(@"%@", error.debugDescription);
}
} ];}
후 didFailWithErrorError 도메인 = kCLErrorDomain 코드 = 0 "(null)"
시뮬레이터에서 실행 중이십니까? –
이 답변을 확인 했습니까? http://stackoverflow.com/questions/1409141/location-manager-error-kclerrordomain-error-0 – Dominic
아니요, iphone5s, iphone6 ipad에서 시도하고 있습니다. –