简体   繁体   English

Xcode-以64位编译应用程序时发生错误

[英]Xcode - Error occurs when compiling app in 64-bit

I am working with Xcode and have changed my app to compile in 32 and 64-bit, this has caused errors to occur. 我正在使用Xcode,并且已更改我的应用程序以在32位和64位进行编译,这导致发生错误。

I am getting the error: "Multiple methods named "count" found with mismatched result, parameter type or attributes" 我收到错误消息:“找到名称,计数类型或属性不匹配的多个方法”

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return [self.sections count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return [[self.sections objectAtIndex: section]  count];
}

I believe this is caused by the 64-bit version no longer viewing them as the same type. 我相信这是由于64位版本不再将它们视为同一类型而引起的。

The error occurs inside the second function. 该错误发生在第二个函数内部。 Is this a matter of simply type casting? 这是简单的类型转换问题吗? If so what should I be casting 'count' to? 如果是这样,我该如何计算?

Thanks guys. 多谢你们。

The compiler doesn't know which method this object responds to. 编译器不知道该对象响应哪种方法。 You send a "count" message. 您发送一个“计数”消息。 The compiler goes through all the count methods of all classes that it knows about. 编译器将遍历它所知道的所有类的所有count方法。 If there are more than two different ones, it has to complain. 如果有两个以上的不同,则必须投诉。

You could write 你可以写

NSArray *tempArray=[self.sections objectAtIndex: section];
return [tempArray  count];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM