1

I m using SBJson version 4.0.0.

I parse my JSON by invoke this function (from SBJson documentation):

+ (id)parserWithBlock:(SBJson4ValueBlock)block
       allowMultiRoot:(BOOL)allowMultiRoot
      unwrapRootArray:(BOOL)unwrapRootArray
         errorHandler:(SBJson4ErrorBlock)eh;

And My code is:

SBJson4Parser *parser = [SBJson4Parser parserWithBlock:^(id item, BOOL *stop) {
    NSObject *itemObject = item;
    
    if ([item isKindOfClass:[NSDictionary class]]) {
        self.activitiesDict = (NSDictionary*)itemObject;
    }
}
                                        allowMultiRoot:NO
                                       unwrapRootArray:NO
                                          errorHandler:^(NSError *error) {
                                              NSLog(@"%@", error);
                                          }];
[parser parse:data];

Does the block that I passed to parserWithBlock function is synchronous?

Can I count that the lines after [parser parse:data]; will run after the parser work?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
gran33
  • 12,421
  • 9
  • 48
  • 76
  • Yes - the blocks here are called during the synchronous processing of the JSON data to provide feedback on progress and ability to abort part way through. – Mark Woollard May 07 '14 at 11:49

1 Answers1

0

Yes, the parse: method is synchronous.

Stig Brautaset
  • 2,602
  • 1
  • 22
  • 39