3
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"app/site_pattern" usingBlock:^(RKObjectLoader* loader) {
    [loader setObjectMapping:clientMappring];
    loader.delegate = self;
    shopLoader = loader;
}];

上面,我使用block函数在我的应用程序中加载了一些数据,但是当我弹出这个viewcontroller时,我不知道何时以及如何取消这个请求。

任何的想法?

- (void)showSelectShop
{

    SelectShopViewController * selectShopViewController = [[SelectShopViewController alloc] initWithNibName:@"SelectShopViewController" bundle:nil];
    [self.navigationController pushViewController:selectShopViewController animated:YES];
}

更多的:

我尝试在 viewDidUnload 中取消它

- (void)viewDidUnload
{
    [super viewDidUnload];
    [shopLoader cancel];
}

但它没有用。我仍然收到错误。

4

1 回答 1

2

我通过添加解决了这个问题

- (void)viewWillDisappear:(BOOL)animated
{
    [shopLoader cancel];
    shopLoader.delegate = nil;
    shopLoader = nil;
}

我还是想知道,如果不想在viewWillDisappear中取消这个请求,那几行应该写在哪个函数里呢?

于 2012-07-16T07:16:49.047 回答