RestKit的对象映射只加载一次

时间:2011-08-31 22:44:59

标签: ios cocoa-touch restkit

-(void)loadEvents{
    NSLog(@"sdfsdf");
    //obtain the theatreType and place it into a string
    NSString *theatre = [NSString stringWithFormat:@"/test/%@.json", self.theatreType];

    RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[WhatsonEvent class]];
    [objectMapping mapKeyPath:@"nid" toAttribute:@"nid"];
    [objectMapping mapKeyPath:@"title" toAttribute:@"title"];
    [objectMapping mapKeyPath:@"poster" toAttribute:@"poster"];
    [objectMapping mapKeyPath:@"by" toAttribute:@"by"];
    [objectMapping mapKeyPath:@"by_name" toAttribute:@"byName"];
    [objectMapping mapKeyPath:@"summary" toAttribute:@"summary"];
    RKObjectManager* manager = [RKObjectManager objectManagerWithBaseURL:@"http://mydomain.com/t_new/js-api"];
    [manager loadObjectsAtResourcePath:theatre objectMapping:objectMapping delegate:self];
}

此方法位于我要将检索到的数据加载到的tableViewController中。此tableViewController有三个实例将被推送到导航控制器。现在,问题是只有推送的第一个实例才会检索数据。如果我推动其他两个实例没有任何反应;该方法触发,但我没有得到任何RK代表(didLoadObjectsdidFailWithError)的回复。我在这做错了什么?

RKOBjectMapping不应该有三个不同的实例,因此每次都有效吗?

修改

我在手机上试了一下它实际上工作了一次。也许,它很慢还是悬挂?

0 个答案:

没有答案
相关问题