我正在尝试从已发送的parse.com中检索数据。
我正在使用以下代码发送数据:
-(IBAction)msgSend:(id)sender {
PFObject *appMsg = [PFObject objectWithClassName:@"appMsg"];
appMsg[@"besked"] = msg.text;
[appMsg saveInBackground];
msg.text = @"";
}
要获取数据我正在尝试这个:
PFQuery *query = [PFQuery queryWithClassName:@"appMsg"];
[query getObjectInBackgroundWithId:@"*******" block:^(PFObject *appMsg, NSError *error) {
NSString *besked = appMsg[@"besked"];
msgRecieved.text = besked;
}];
最后我试图将数据显示到textView。
我真的没有加载任何数据吗?
答案 0 :(得分:0)
PFQuery *query = [PFQuery queryWithClassName:@"tempClass"];
[query orderByDescending:@"createdAt"];
query.limit =10;
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
// Retrive values like below,object id is retrieved by objects.objectId
NSLog(@"Object values %@",[objects valueForKey:@"columnName"]);
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];