使用Seague传递parse.com信息以更改parseClassName

时间:2015-03-22 04:02:51

标签: ios objective-c parsing

我像这样设置我的segue

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Check that a new transition has been requested to the DetailViewController and prepares for it
    if ([segue.identifier isEqualToString:@"parse"]){

        // Capture the object (e.g. exam) the user has selected from the list
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        PFObject *object = [self.objects objectAtIndex:indexPath.row];
        // Set destination view controller to DetailViewController to avoid the NavigationViewController in the middle (if you have it embedded into a navigation controller, if not ignore that part)
        FWProductTableViewController *detailViewController = (FWProductTableViewController *)segue.destinationViewController;
        detailViewController.exam = object;
        NSLog(@"%@", object);

    }
}

在我的detailTableViewController中,我已经设置了这个。

- (void)viewDidLoad {
    [super viewDidLoad];
    self.myClass = [self.exam objectForKey:@"serieClass"];
    NSLog(@"%@", self.myClass);

}

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


    return query;

}

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

        self.parseClassName = self.myClass;
        NSLog(@"%@ parseClassName",self.parseClassName);


        // The key of the PFObject to display in the label of the default cell style
        self.textKey = [self.exam objectForKey:@"navnFestival"];

        self.imageKey = @"produktBilde";

        self.textKey = @"serieFestival";

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

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

在我看来,这应该是一种有效的方式。但我收到一条控制台消息说

2015-03-22 17:09:09.814 Festival Fyrverkeri[1717:349918] 2015-12-31 17:00:00 +0000
2015-03-22 17:09:12.426 Festival Fyrverkeri[1717:349918] error: (null)
2015-03-22 17:09:12.647 Festival Fyrverkeri[1717:349918] error: (null)
2015-03-22 17:09:14.308 Festival Fyrverkeri[1717:349918] (null)
2015-03-22 17:09:14.309 Festival Fyrverkeri[1717:349918] (null) parseClassName
2015-03-22 17:09:14.310 Festival Fyrverkeri[1717:349918] <Serie: 0x14ed63b0, objectId: aXQehF5Rpr, localId: (null)> {
    serie = Blizzard;
    serieBeskrivelse = "Se hele Blizzard Serien";
    serieBilde = "<PFFile: 0x14f94520>";
    serieClass = Fyrverkeri;
}
2015-03-22 17:09:14.319 Festival Fyrverkeri[1717:349918] Fyrverkeri
2015-03-22 17:09:14.495 Festival Fyrverkeri[1717:349969] [Error]: bad characters in classname: (null) (Code: 103, Version: 1.6.4)

我可以看到信息存在,但似乎在信息可供使用之前加载了parseClassName。任何人都知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

想通了。

PFQuery *query = [PFQuery queryWithClassName:[self.exam objectForKey:@"serieClass"]];