I'm currently using synchronous ASIHTTPRequest with GCD queues to download data from the Internet, then parse the response data with JSONKit. What do you think about this pattern. Thank you in advance.
Here is my code:
dispatch_async(queue, ^(void) {
// Request is ASIHTTPRequest.
[request startSynchronous];
// Parse JSON.
NSArray *array = [[request responseData] objectFromJSONDataWithParseOptions:JKParseOptionLooseUnicode];
// Callback on the main queue to update UI.
dispatch_async(dispatch_get_main_queue(), ^(void) {
callbackBlock(array);
});
});
EDIT: The reason I use ASIHTTPRequest is that I need to modify the request header for OAuth and use POST method to upload images.