PFQuery不更新对象

时间:2015-05-05 02:51:58

标签: ios objective-c parse-platform

我有viewDidLoad中调用的以下方法。它工作正常。但是,在另一种方法中,当我更改值并尝试再次调用以下方法时,它不会更新。为什么会这样做?我该如何解决这个问题?

- (void)initialStuff {
    PFQuery *query = [PFQuery queryWithClassName:@"Friends"];
    [query whereKey:@"user" containsString:[[PFUser currentUser] objectForKey:@"username"]];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        for (Friends *currentFriend in objects) {
            PFFile *file = currentFriend.photo;
            [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {
                if (!error) {
                    UIImage *image = [UIImage imageWithData:data];
                    self.chosenImage.image = image;
                }
            }];
            NSLog(@"worked");
            self.chosenText.text = currentFriend.text;

            NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:currentFriend.artwork]];
            self.songImage.image = [UIImage imageWithData:imageData];
            self.songName.text = currentFriend.trackName;
            self.artistLabel.text = currentFriend.artist;

            self.songURL = [NSURL URLWithString:currentFriend.preview];
        }
    }];
}

查询怎么找到过时的信息?

0 个答案:

没有答案