UITableView突然没有从Parse中检索数据

时间:2014-06-12 19:40:28

标签: ios objective-c uitableview parse-platform

昨天工作正常,没有任何触及它今天停止工作。当我运行查询以分配我的' filterEvents'数组,'对象'在块中是空的。任何人都知道发生了什么?

#import "FilterViewController.h"

@interface FilterViewController ()
@end

@implementation FilterViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.filterTable.dataSource = self;
    self.filterTable.delegate = self;
    [self performSelector:@selector(retrieveFilteredEvents)];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.filterEvents count];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *cellIdentifier = @"filterTableCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];


     NSDictionary *tempDict = [self.filterEvents objectAtIndex:indexPath.row];

    self.eventTitle = [tempDict objectForKey:@"eventType"];
    cell.textLabel.text = self.eventTitle;

    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *tempDict = [self.filterEvents objectAtIndex:indexPath.row];
    NSString *string = [tempDict objectForKey:@"eventType"];

    [self.delegate setFilter:string];

    [self dismissViewControllerAnimated:YES completion:nil];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"updateParent" object:nil];
}

#pragma mark - Helper Methods

- (IBAction)done:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)retrieveFilteredEvents
{
    PFQuery *retrieveEvents = [PFQuery queryWithClassName:@"eventTypes"];
    [retrieveEvents orderByAscending:@"eventOrder"];
    [retrieveEvents findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
        if (!error) {
            self.filterEvents = [[NSArray alloc] initWithArray:objects];
            NSLog(@"%@", self.filterEvents);
        }
        [self.filterTable reloadData];
    }];
}

@end

0 个答案:

没有答案