Question

How do I solve this warning?

enter image description here

The warning is "undeclared selector 'forwardGeocoderDidFail:withErrorMessage:'". Why am I getting this warning, and how can I solve it?

This is my code:

if (!handeledByBlocks && self.delegate) {
    if (!parseError && parser.statusCode == G_GEO_SUCCESS)
    {
        [self.delegate forwardGeocodingDidSucceed:self withResults:parser.results];
    }
    else if ([self.delegate respondsToSelector:@selector(forwardGeocoderDidFail:withErrorMessage:)])
    {
        [self.delegate forwardGeocodingDidFail:self withErrorCode:parser.statusCode andErrorMessage:[parseError localizedDescription]];
    }        
}
Was it helpful?

Solution

Replace

[self.delegate respondsToSelector:@selector(forwardGeocoderDidFail:withErrorMessage:)]

with

[self.delegate respondsToSelector:@selector(forwardGeocodingDidFail:withErrorCode:andErrorMessage:)]

OTHER TIPS

Whatever you're setting as the delegate does not have a public method called: forwardGeocoderDidFail:withErrorMessage:

That's what's causing the warning that you want to fix.

In the line below, you're calling a method with a different signature.

forwardGeocoderDidFail: withErrorCode: andErrorMessage:

Make sure whatever object is your delegate actually implements the correct method, and that respondsToSelector actually checks the one you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top