在尝试实现PARSE PFQueryTableViewController时,抛出线程1发出SIGABRT信号

时间:2013-09-13 22:57:40

标签: ios uitableview parse-platform backend pfquery

无论我尝试什么,我似乎无法通过PFQueryTableViewController更改UITableView。我已经添加了代码,通过代码返回,摆脱了代码,从UITableView更改后,它似乎都抛出相同的错误 我明白了   * 由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:' - [UITableViewController loadView]加载了“2-view-3”笔尖,但没有得到UITableView。'

我只是想从PARSE填充一张桌子,基本的东西,但我只是想用我有限的能力来帮助我的弟弟。任何帮助将不胜感激

这是一些代码。我在我的appdelegate中链接到解析,一切都很好。我测试了那个。

ViewController.h

#import <UIKit/UIKit.h>
#import <Parse/Parse.h>

@interface BaliPartyViewController :  PFQueryTableViewController




@end

ViewController.m

#import "BaliPartyViewController.h"
#import "PartyDetailViewController.h"
#import "CustomCell.h"


@interface BaliPartyViewController ()

@end

@implementation BaliPartyViewController {

}


- (id)initWithCoder:(NSCoder *)aCoder
{
    self = [super initWithCoder:aCoder];
    if (self) {
        // The className to query on
        self.parseClassName = @"Recipe";

        // The key of the PFObject to display in the label of the default cell style
        self.textKey = @"name";

        // Whether the built-in pull-to-refresh is enabled
        self.pullToRefreshEnabled = YES;

        // Whether the built-in pagination is enabled
        self.paginationEnabled = NO;
    }
    return self;
}

- (PFQuery *)queryForTable
{
    PFQuery *query = [PFQuery queryWithClassName:self.parseClassName];

    return query;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object
{
    static NSString *simpleTableIdentifier = @"CustomCell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
    }

    // Configure the cell
    PFFile *thumbnail = [object objectForKey:@"imageFile"];
    PFImageView *thumbnailImageView = (PFImageView*)[cell viewWithTag:100];
    thumbnailImageView.image = [UIImage imageNamed:@"placeholder.jpg"];
    thumbnailImageView.file = thumbnail;
    [thumbnailImageView loadInBackground];

    UILabel *nameLabel = (UILabel*) [cell viewWithTag:101];
    nameLabel.text = [object objectForKey:@"name"];

    UILabel *prepTimeLabel = (UILabel*) [cell viewWithTag:102];
    prepTimeLabel.text = [object objectForKey:@"prepTime"];

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   if (tableView == self.searchDisplayController.searchResultsTableView) {
        [self performSegueWithIdentifier: @"showPartyDetail" sender: self];
    }
}

/*- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"showPartyDetail"]) {
        PartyDetailViewController *destViewController = segue.destinationViewController;

        NSIndexPath *indexPath = nil;
        if ([self.searchDisplayController isActive]) {
            indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
            destViewController.partyName = [searchResults objectAtIndex:indexPath.row];
            destViewController.partyDate = [searchResults objectAtIndex:indexPath.row];
            destViewController.information = [searchResults objectAtIndex:indexPath.row];
            destViewController.location = [searchResults objectAtIndex:indexPath.row];

        } else {
            indexPath = [self.tableView indexPathForSelectedRow];
            destViewController.partyName = [parties objectAtIndex:indexPath.row];
            destViewController.partyDate = [partyTime objectAtIndex:indexPath.row];
            destViewController.information = [information objectAtIndex:indexPath.row];
            destViewController.location = [location objectAtIndex:indexPath.row];
            destViewController.photo = [detailPicture objectAtIndex:indexPath.row];

        }
        // Hide bottom tab bar in the detail view
        destViewController.hidesBottomBarWhenPushed = YES;
    }

}*/




@end

0 个答案:

没有答案