RKObjectRequestOperation - synchonous issue

149 views
Skip to first unread message

Marcos Barbero

unread,
May 24, 2013, 9:04:50 AM5/24/13
to res...@googlegroups.com
Hi everyone.
Using the following example, from the RestKit git page:

RKObjectRequestOperation *operation = [[RKObjectRequestOperation alloc] initWithRequest:request responseDescriptors:@[responseDescriptor]]; 
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *result) {
    NSLog(@"The public timeline Tweets: %@", [result array]);
} failure:nil];
[operation start];

It works fine, but the completionBlock runs asynchronous, is there a way to run it synchronous? I need a way to wait this request be done before run my next statement.



Regards.



Blake Watters

unread,
May 24, 2013, 11:07:14 AM5/24/13
to res...@googlegroups.com
You can call `[operation waitUntilFinished];` but you probably do not want to do this. If this is on your UI thread then you will have completely stopped the UI from responding until the request finishes. You should look at using callbacks or operations instead of synchronous blocking





--
You received this message because you are subscribed to the Google Groups "RestKit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to restkit+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Marcos Barbero

unread,
May 24, 2013, 12:37:17 PM5/24/13
to res...@googlegroups.com
Thanks Blake.
I'll look for callbacks.
Reply all
Reply to author
Forward
0 new messages