I'm using RestKit version 0.2 and I'm seeing it block the UI (meaning, the UI becomes choppy/unresponsive) when I call RKRequestOperation as follows:
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
NSString *urlString = [NSString stringWithFormat:@"http://localhost:8080/models?offset=%d&rows=%d", _offset, _numRows];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[_responseDescriptor]];
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {
NSLog(@"Got models: %@", [result array]);
[self addModelsToView:[results array]];
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"FAILED!");
}];
[operation start];
}
A bit more background:
I'm doing this to load new model views into an infinite UIScrollView
. I detect when the user scrolls to the bottom of the view (coordinate logic redacted), use RestKit as above to load the next set of views, and when the models return I load them into the scroll view in addModelsToView
. Even when I comment out addModelsToView
, the choppy logic remains, so I'm certain it's something to do with RestKit (or how I'm using it, at least).
From what I understand about RestKit is that it does load asynchronously, so I'm having trouble finding why/where the choppyness is occurring.
Thanks in advance!