我对 Xcode 和 Parse 有点陌生,并且正在 socket 集合中创建一个查询。一切看起来都很好,除了我收到一条错误消息,指出“在‘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]);
}
}];
任何人都可以帮助我,这样我就可以让这个构建不会失败吗?
最佳答案
改变这个:
(UILabel *) self.EventTitles[i].text = object.objectId;
到:
[(UILabel *)self.EventTitles[i] setText:object.objectId];
关于objective-c - 在对象上找不到属性文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21339304/