在对象上找不到属性文本

时间:2014-01-24 17:58:52

标签: objective-c compiler-errors labels

我对Xcode和Parse有点新,并且我在outlet集合中创建了一个查询。一切看起来都不错,除了我收到一条错误,指出“属性'文字'在'id'类型的对象上找不到”...这是我的代码:

[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    if (!error) {
        // The find succeeded.
        NSLog(@"Successfully retrieved %d scores.", objects.count);
        // Do something with the found objects
        int i = 0;
        for (PFObject *object in objects) {
            if (i >= [self.EventTitles count]) break;//to make sure we only write up to the max number of UILabels available in EventTitles
            (UILabel *) self.EventTitles[i].text = object.objectId;//I assume the "objectId" property of object is an NSString!
            i++;
        }
    } else {
        // Log details of the failure
        NSLog(@"Error: %@ %@", error, [error userInfo]);
    }
}];

任何人都可以帮助我,所以我可以让这个版本不失败吗?

1 个答案:

答案 0 :(得分:1)

改变这个:

(UILabel *) self.EventTitles[i].text = object.objectId;

为:

[(UILabel *)self.EventTitles[i] setText:object.objectId];
相关问题