Xcode 6.1 : Multiple methods named 'count' found with mismatched result, parameter type or attributes

Jayprakash Dubey picture Jayprakash Dubey · Jan 2, 2015 · Viewed 16.9k times · Source

I'm getting Multiple methods named 'count' found with mismatched result, parameter type or attributes error while building app. The app was working fine in 32 bit. I have changed it to 64 bit as per Apple guideline. I have referred this Link but don't got any help.

I have tested app on multiple devices on simulator. It works fine on 32 bit but prompts error in 64 bit. Why is this so?

 -(void)serviceSuccessFulForPatientSelect:(id)response
{
    [self hideOverlay];
    if([response isKindOfClass:[NSArray class]])
    {
        if([response count]>0)
        {
            if(1)
            {
               ...
            }
        }
    }
    [refillDetailTable reloadData];

}

Error

Answer

jrturton picture jrturton · Jan 2, 2015
if([response count]>0)

response is an id here, the error suggests there are multiple methods called count which return different types - int and NSInteger I think are different in 64-bit but the same in 32.

To fix, perform a cast:

if([(NSArray*)response count]>0)