Xcode 6.1:找到了名为'count'的多个方法,其中包含不匹配的结果,参数类型或属性

Jay*_*bey 20 methods compiler-errors ios xcode6.1

我正在获得多个名为'count'的方法,在构建应用程序时发现结果不匹配,参数类型或属性错误.该应用程序在32位工作正常.我根据Apple指南将其更改为64位.我已经推荐了这个链接,但没有得到任何帮助.

我在模拟器上测试了多个设备上的应用程序.它在32位上工作正常但在64位时提示错误. 为什么会这样?

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

}
Run Code Online (Sandbox Code Playgroud)

错误

jrt*_*ton 25

if([response count]>0)
Run Code Online (Sandbox Code Playgroud)

responseid这里,错误提示有多种方法叫count其返回不同类型的- int而且NSInteger,我认为是在64位不同,但在32不变.

要修复,请执行强制转换:

if([(NSArray*)response count]>0)
Run Code Online (Sandbox Code Playgroud)


Jay*_*bey 11

解决方案1:在视图控制器中声明了count作为属性.我将它重命名为CountValue,问题解决了.

解决方案2: 您可以键入类型转换为适当的数据类型.

if([(NSArray *) response count]>0) {
  ...
}
Run Code Online (Sandbox Code Playgroud)

这个解决方案在我的案例中是不可行的,因为有1000个地方包含[response count].