Created
May 25, 2014 18:49
-
-
Save betzerra/d3259ae845105acd76b5 to your computer and use it in GitHub Desktop.
CLGeocoder: kCLErrorDomain == 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Error reported in http://stackoverflow.com/questions/23819466/error-return-address-clgeocoder | |
NSString *anAddressString = @"568 Broadway, New York, NY" | |
CLGeocoder *geocoder = [[CLGeocoder alloc] init]; | |
void (^geocodeBlock)(NSArray *placemarks, NSError *error) = ^(NSArray *placemarks, NSError *error) { | |
if (error) { | |
/* | |
* Printing error gets -> Error Domain=kCLErrorDomain Code=2 "The operation couldn’t be | |
* completed. (kCLErrorDomain error 2.)" | |
* | |
* kCLErrorDomain 2 == kCLErrorNetwork | |
* https://developer.apple.com/library/mac/documentation/CoreLocation/Reference/CoreLocationConstantsRef/Reference/reference.html | |
* | |
* Also, debug console is printing: | |
* /SourceCache/ProtocolBuffer_Sim/ProtocolBuffer-187.4/Runtime/PBRequester.m:825 server | |
* (https://gsp-ssl.ls.apple.com/fwdgeo.arpc) returned error: 500 | |
*/ | |
} else { | |
if ([placemarks count] == 0) { | |
// Query ends successfully but there's no location with that string | |
} else if ([placemarks count] == 1) { | |
// Query ends successfully and there's a location | |
} else if ([placemarks count] > 1) { | |
/* | |
* Query ends successfully and there're more than one location. You'll probably need | |
* to ask the user what address he's looking for | |
*/ | |
} | |
} | |
}; | |
[geocoder geocodeAddressString:anAddressString completionHandler:geocodeBlock]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment