我正在使用 Xcode 并将我的应用程序更改为在 32 位和 64 位中编译,这导致发生错误。
我收到错误: “发现多个名为“count”的方法具有不匹配的结果、参数类型或属性”
- (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];
}
我相信这是由于 64 位版本不再将它们视为同一类型造成的。
错误发生在第二个函数内部。这是简单类型转换的问题吗?如果是这样,我应该将“计数”转换为什么?
谢谢你们。
最佳答案
编译器不知道该对象响应哪个方法。您发送一条“计数”消息。编译器会遍历它所知道的所有类的所有 count 方法。如果有两个以上不同的,它必须提示。
你可以这样写
NSArray *tempArray=[self.sections objectAtIndex: section];
return [tempArray count];
关于ios - Xcode - 以 64 位编译应用程序时发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29337856/