NSSet枚举错误

时间:2013-09-17 17:30:04

标签: iphone ios objective-c core-data nsset

抱歉新手问题,但我们都在这一点上:)

我正在进行枚举,从NSSet中获取正确的对象,将Set的标题设置为Set中的对象,这是我的代码:

    // the object we want from the set
MinorGoal *minor = [self.fetchedResultsController objectAtIndexPath:indexPath];

// enumeration
for (NSManagedObject *minorTwo in minorGoalsSet) {
    if ([minorTwo == minor]) // I get error here: "Expected Identifier"
        cell.textLabel.text = minor.title;


}

当我运行它时,我收到错误:此行上的“预期标识符”:

if ([minorTwo == minor])

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

你的陈述是荒谬的。如果您要比较两个对象,则需要发送消息:

if ([minorTwo isEqual:minor])

或者沿着那些方向徘徊。因为它们是不同类的实例,但这可能不适合你。