views:

401

answers:

3

I keep getting this randomly when I run my gps app I'm building. It doesn't happen everytime, and the coordinates passed in are always valid (i nslog them). Is there documentation for these somewhere?

EDIT:

CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(locManager.location.coordinate.latitude, locManager.location.coordinate.longitude);
geocoder1 = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
geocoder1.delegate = self;
[geocoder1 start];

and then about half the time it returns an error. I tried releasing and re-assigning the geocoder if there was an error, but that didn't help. Only thing that did was restarting the app.

+1  A: 

In "MKTypes.h" in the MapKit framework, the following is defined:

Error constants for the Map Kit framework.

enum MKErrorCode {
   MKErrorUnknown = 1,
   MKErrorServerFailure,
   MKErrorLoadingThrottled,
   MKErrorPlacemarkNotFound,
};

...

MKErrorPlacemarkNotFound

The specified placemark could not be found.

This sounds like you are referencing some unknown placemark in your code? Or it could be that Google doesn't have a name for the position you are passing - however valid the coordinates may be.

Claus Broch
Yeah I came across those constants, but the problem is how to fix it, and more curiously, why it seems to happen randomly. Is it maybe getting different levels of accuracy different times and having more/less decimal places?
marty
If you posted some code showing where you get these errors, it will be a lot easier to assist you.
Claus Broch
See edit above.
marty
A: 

Actually, I am running into this problem as well. Code is extremely compact

//1. ask map for current coords

CLLocationCoordinate2D userLocation;

userLocation.latitude = [[_theMapView.userLocation location] coordinate].latitude; userLocation.longitude = [[_theMapView.userLocation location] coordinate].longitude;

NSLog(@"%f, %f",userLocation.latitude,userLocation.longitude);

//2. reverse geocode coords

MKReverseGeocoder *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:userLocation];

[reverseGeocoder setDelegate:self];

[reverseGeocoder start];

and later simply NSLog the error in the fail delegate method. It works the first time or two, then stops working

Jackie Treehorn
A: 

I just got done with a lot of research on this problem and it seems to be outside of our hands. I checked the developer forums as well as all around Stack and elsewhere and no one has a solution other than using a different service. There is a pretty good thread at https://devforums.apple.com/message/154126 on the subject.

Some people find the error after a certain time, I just find it to be out for a while and then comes back. I looked at the "Current Address" sample code and I couldn't see how I might have messed up. I ran the sample code and sure enough, it was NSLogging errors instead of returning a location.

This link has some code using Google's reverse geocoder: http://www.iphonedevsdk.com/forum/iphone-sdk-development/31883-pbrequestererrordomain-errors-reverse-geocoding.html#post155793

Clay Horste