24

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

Community
  • 1
  • 1
Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177

3 Answers3

33
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)
jrturton
  • 118,105
  • 32
  • 252
  • 268
  • 1
    It's not feasible for casting since there are around 1000s places to be changed...Any other fix – Jayprakash Dubey Jan 02 '15 at 10:03
  • 1
    Thousands of places? Your alternative is to find the other count method (presumably in your code) and change the return type. But if you have thousands of id objects you're counting, that sounds wrong. – jrturton Jan 02 '15 at 10:20
14

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].

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
0

Double check your response, is there any property with name count

PVCS
  • 3,831
  • 1
  • 16
  • 10