Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 864
Jayprakash Dubey Avatar asked Jan 02 '15 09:01

Jayprakash Dubey


2 Answers

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)
like image 158
jrturton Avatar answered Dec 15 '22 16:12

jrturton


Solution 1: I had declared count as property in a view controller. I renamed it to CountValue and the problem got solved.

Solution 2: You can type-cast to appropriate datatype.

if([(NSArray *) response count]>0) {
  ...
}

This solution was not feasible in my case since there were 1000s of place containing [response count].

like image 42
Jayprakash Dubey Avatar answered Dec 15 '22 16:12

Jayprakash Dubey