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

标签 ios objective-c xcode types 64-bit

我正在使用 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/

相关文章:

xcode - 用于在 xcode 中将输入焦点切换到控制台的热键

objective-c - UIScreen亮度超出最大值

ios - 将 UITableView 导出为 PDF

ios - 设置 Core Plot 饼图图例项目的样式

ios - 删除推送通知 api?

iphone - 如何检测哪个 3rd sdk 使用 UDID?

ios - iOS导航栏中的特殊符号字符

ios - 在 Swift 中迭代日期范围的最有效方法是什么?

objective-c - 核心动画和设备方向

objective-c - 按下 enter 时 UISearchBar 不会关闭键盘